runkit.js 427 B

12345678910111213141516171819202122
  1. const md = require('markdown-it')()
  2. const anchor = require('markdown-it-anchor')
  3. md.use(anchor, {
  4. level: 1,
  5. // slugify: string => string,
  6. permalink: false,
  7. // renderPermalink: (slug, opts, state, permalink) => {},
  8. permalinkClass: 'header-anchor',
  9. permalinkSymbol: '¶',
  10. permalinkBefore: false
  11. })
  12. const src = `# First header
  13. Lorem ipsum.
  14. ## Next section!
  15. This is totaly awesome.`
  16. console.log(md.render(src))