This is a plugin for the markdown-it markdown parser. This plugin add class attributes to html elements.
npm install @toycode/markdown-it-class --save-dev
Although it will work with "yarn", I have not tried it.
const MarkdownIt = require('markdown-it')
const markdownItClass = require('@toycode/markdown-it-class')
const mdText = '# Hello'
const mapping = { h1: 'title' }
const md = MarkdownIt().use(markdownItClass, mapping)
console.log(md.render(mdText))
// <h1 class="title">Hello</h1>
const MarkdownIt = require('markdown-it')
const markdownItClass = require('@toycode/markdown-it-class')
const mdText = '# Hello\n## *Markdown* world'
const mapping = { h1: ['title', 'is-4'], h2: 'subtitle', em: 'tag' }
const md = MarkdownIt().use(markdownItClass, mapping)
console.log(md.render(mdText))
// <h1 class="title is-4">Hello</h1>
// <h2 class="subtitle"><em class="tag">Markdown</em> world</h2>