@xmark/transform-wrap-headings
TypeScript icon, indicating that this package has built-in type declarations

0.24.0 • Public • Published

@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);

Readme

Keywords

Package Sidebar

Install

npm i @xmark/transform-wrap-headings

Weekly Downloads

7

Version

0.24.0

License

MIT

Unpacked Size

9.87 kB

Total Files

4

Last publish

Collaborators

  • mave99a
  • wangshijun