BBob
BBob copied to clipboard
Feature request: Add position in the string for each node
Thanks for this library, it works well and I didn't found any issue 🚀
It could be nice to add information about each node like the position in the original string and the length of start/end tag (including the separator character, arguments and spaces).
It could be also nice to have the raw inner content of the current tag (if I want to make a [code][/code] tag that don't render anything in it).
For the following string: "example [b=value] my text [/b ] end", we could imagine to add a startTag and endTag with the following informations:
[
"example",
" ",
{
"tag": "b",
"attrs": {
"value": "value"
},
startTag: {
"index": 8,
"length: 9
},
endTag: {
"index": 26,
"length: 7
},
"content": [
" ",
"my",
" ",
"text",
" "
]
},
" ",
"end"
]
What do you think?
Good idea. It can produce more useful information when error occurs.