@xmark/transform-wrap-headings
v0.24.0
Published
Convert flat markdown ast to nested html ast, support customization
Downloads
34
Readme
@xmark/transform-wrap-headings
Wrap flat html tag list (from markdown ast) with section divs for different levels
Usage
const XMark = require('@xmark/core');
const TransformWrapHeadings = require('@xmark/transform-wrap-headings');
const xmark = XMark();
xmark.useTransform(TransformWrapHeadings, {
parseAttributes: true,
parseStyleAttributes: true,
wrapperTag: 'section',
enabledHeadings: ['h1'],
wrapperClasses: {
wrapper: 'section',
modifier: x => `section--level${x}`,
},
});
const markdown = '# heading 1';
const hast = xmark.toHAST(markdown);
const html = xmark.toHTML(markdown);