/** * Copyright (c) 2017-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ const toSlug = require('./toSlug.js'); /** * The anchors plugin adds GFM-style anchors to headings. */ function anchors(md) { md.renderer.rules.heading_open = function(tokens, idx, options, env) { const textToken = tokens[idx + 1]; const anchor = toSlug(textToken.content, env); return ( '' ); }; } module.exports = anchors;