// [b]bolded text[/b] => bolded text // [i]italicized text[/i] => italicized text // [u]underlined text[/u] => underlined text // [s]strikethrough text[/s] // => strikethrough text // [url]https://en.wikipedia.org[/url] => https://en.wikipedia.org // [url=http://step.pgc.edu/]ECAT[/url] => ECAT // [img]https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/Go-home-2.svg/100px-Go-home-2.svg.png[/img] // => // [quote="author"]quoted text[/quote] =>

quoted text

// [code]monospaced text[/code] =>
monospaced text
// [style size="15px"]Large Text[/style] => Large Text // [style color="red"]Red Text[/style] => Red Text /** [list] [*]Entry 1 [*]Entry 2 [/list] [list] *Entry 1 *Entry 2 [/list] => */ /** [table] [tr] [td]table 1[/td] [td]table 2[/td] [/tr] [tr] [td]table 3[/td] [td]table 4[/td] [/tr] [/table] =>
table 1table 2
table 3table 4
*/ // [b]bolded text[/b] => bolded text const processors = { b: node => ({ tag: 'span', attrs: { style: 'font-weight: bold;', }, content: node.content, }), i: node => ({ tag: 'span', attrs: { style: 'font-style: italic;', }, content: node.content, }), }; module.exports = function html5Preset(opts = {}) { return function process(tree) { tree.forEach((node) => { if (node.tag && processors[node.tag]) { return processors[node.tag](node, opts); } return node; }); }; };