Skip to content

Instantly share code, notes, and snippets.

@dinocarl
Last active February 24, 2020 20:34
Show Gist options
  • Save dinocarl/1735530ec07e5471f87ffb86d204e104 to your computer and use it in GitHub Desktop.
Save dinocarl/1735530ec07e5471f87ffb86d204e104 to your computer and use it in GitHub Desktop.
const md = require('markdown-it')();
const markdownItAttrs = require('markdown-it-attrs');
const src = `
# header {: .title-class #title-id }
some text {: with=attrs and="attrs with space" }
more body copy with some *emphasis*{: .emph-class } thrown in {: .para-class}
- item 1
- item 2 {: .item-class }
- item 3
{: .list-class }
`;
// render markdown
md
.use(
markdownItAttrs,
// support kramdown
{ leftDelimiter: '{:' }
)
.render(src);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment