-
Hi. I have string like this:
How i can wrap |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @arkhamvm parser result your string as AST [
{
"tag": "h2",
"attrs": {},
"content": [
"Header",
" ",
"text"
]
},
"\\r\\nBefore",
" ",
"text\\r\\n",
{
"tag": "img",
"attrs": {
"src": "https://www.google.com/favicon.ico"
},
"content": null
},
"\\r\\nAfter",
" ",
"Text",
"\n"
] You can try transform this array by yourself, like this import bbob from '@bbob/core'
import { render } from '@bbob/html'
import presetHTML5 from '@bbob/preset-html5'
const processed = bbob(presetHTML5()).process(`[h2]Header text[/h2]\r\nBefore text\r\n[img]https://www.google.com/favicon.ico[/img]\r\nAfter Text`, { render })
const myTree = myTransformFunc(processed.tree);
const html = render(myTree); You can match start and end points by '\r\n' chars. Currently plugin system don't have any pre and post parse transformation api. If you have any ideas how this api would look like, I will be glad to hear it. |
Beta Was this translation helpful? Give feedback.
-
@JiLiZART thanks, i made it similar to |
Beta Was this translation helpful? Give feedback.
Hi @arkhamvm parser result your string as AST
You can try transform this array by yourself, like this