How enable/add custom attributes/enable any attribute? #47
Answered
by
JiLiZART
wintercounter
asked this question in
Q&A
-
I'm trying to figure out from source code but couldn't really get where and how to pass options to make this work, the docs are not so imformative about this. At the company we have our own BBCode syntax. We allow attributes with |
Beta Was this translation helpful? Give feedback.
Answered by
JiLiZART
Sep 12, 2019
Replies: 1 comment
-
Hi, @wintercounter you can extend default html5 preset. import html5Preset from "@bbob/preset-html5";
import toHTML from "@bbob/html";
const myPreset = html5Preset.extend(tags => ({
...tags,
b: (node, params) => ({
...tags.b(node, params),
attrs: {
style: "font-weight: bold;"
},
content: JSON.stringify(node.attrs)
})
}));
document.body.innerHTML = toHTML(`[b @class="myClass"]Text[/b]`, [myPreset()]); Demo example |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
JiLiZART
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, @wintercounter you can extend default html5 preset.
Demo example
https://codesandbox.io/embed/blue-water-l0pc6