Closed esatterwhite closed 6 years ago
Hmm, that’s funky! a) why? and b) how should we do this?
Well I want comments in the html basically. I'm using HAST to generate html documents from user input via JSON api. So in translating to html, its exceptionally helpful to use html comments to debug.
I use this package to remove scripts, clean up html, etc. But it's also removing my comment markers.
{
"type": "conversation"
, ... options
}
<!-- START BLOCK CONVERSATION -->
... 3000 lines of generated html
<!-- END BLOCK CONVERSATION -->
That is all I'm really after.
I have a fork, where i did this
const NODES = {
root: {children: all}
, element: {
tagName: handleTagName
, properties: handleProperties
, children: all
}
, text: {value: handleValue}
, comment: {value: handleValue}
, '*': {
data: allow
, position: allow
}
}
that allows them, just not sure if that is the most efficient thing? of if you know of a better way?
That works for your fork, as it allows every comment, right? but that’s no how GH does it, and should be configurable I think.
I think we should check some property in the schema, roughly around here, to see if comments should be allowed?
@esatterwhite Are you into writing a PR for this?
I see in the tests, that it removes comments, but I'd actaully like to keep comments. Is there an option for it, or how would I be able to do that?
I added
in the node schema and that seems to do what I want. Not sure if that is ideal or if there is a better place for it.