0.11.9 • Published 5 years ago
@xmark/transform-landing-page v0.11.9
@xmark/transform-landing-page
XMark plugin to compose landing pages with markdown, must be used together with
@xmark/transform-wrap-headings
Usage
const fs = require('fs');
const h = require('hastscript');
const inspect = require('unist-util-inspect');
const XMark = require('@xmark/core');
const wrap = require('@xmark/transform-wrap-headings');
const plugin = require('@xmark/transform-landing-page');
const markdownExtensions = {
ContactForm: h('contact-form', {}),
ActionButton: h('action-button', {
text: '::content::',
href: '::argument::',
icon: '::prop::icon::',
border: '::prop::border::',
theme: '::prop::theme::',
size: '::prop::size::',
width: '::prop::width::',
color: '::prop::color::',
gradient: '::prop::gradient::',
}),
ContentIcon: h('content-icon', { name: '::content::', color: '::argument::' }),
MuiPaper: h('mui-paper'),
};
const xmark = XMark({
extensionConfig: {
elements: Object.keys(markdownExtensions).reduce((acc, x) => {
delete markdownExtensions[x].type;
acc[x] = { html: markdownExtensions[x] };
return acc;
}, {}),
},
});
xmark.useTransform(wrap, {
parseAttributes: true,
parseStyleAttributes: true,
wrapperTag: 'section',
enabledHeadings: ['h2', 'h4', 'h5', 'h6'],
wrapperClasses: {
wrapper: 'section',
modifier: x => `section--level${x}`,
},
});
xmark.useTransform(plugin, {
selectors: {
sectionImage: 'p:has(img)',
},
});
const hast = xmark.toHAST(fs.readFileSync(`./tests/markdown/${template}.md`).toString());
console.log(template, inspect(hast));
0.11.9
5 years ago
0.11.8
5 years ago
0.11.7
5 years ago
0.11.5
5 years ago
0.11.4
5 years ago
0.11.3
5 years ago
0.11.2
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
0.8.1
5 years ago
0.8.0
5 years ago
0.7.0
5 years ago
0.6.0
5 years ago
0.5.0
5 years ago
0.4.1
5 years ago
0.3.0
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago