0.24.0 • Published 4 years ago

@xmark/transform-template v0.24.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

@xmark/transform-template

xmark plugin to render templates on hast and front matter, and return hast/html to later processing

Usage

yarn add @xmark/core @xmark/transform-template
const XMark = require('@xmark/core');
const render = require('@xmark/transform-template');

const xmark = XMark();
xmark.useTransform(render, {
  template: '<h1>{{title}}</h1><h2>{{author}}</h2><div>{{{body}}}</div>',
});
const hast = xmark.toHAST('---\ntitle: "title"\nauthor: "author"\n---\n# heading 1');
const html = xmark.toHTML('---\ntitle: "title"\nauthor: "author"\n---\n# heading 1');

expect(hast.children[0].tagName).toEqual('html');
expect(html).toEqual(
  '<html><head></head><body><h1>title</h1><h2>author</h2><div><h1>heading 1</h1></div></body></html>'
);
0.24.0

4 years ago

0.23.1

4 years ago

0.22.0

4 years ago

0.21.0

4 years ago

0.20.0

5 years ago

0.19.0

5 years ago

0.18.0

5 years ago

0.17.0

5 years ago

0.16.0

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.2

5 years ago

0.9.1

5 years ago