rehypejs / rehype-format

plugin to format HTML
https://unifiedjs.com
MIT License
30 stars 4 forks source link

How to deal with fragments? #8

Closed StarpTech closed 6 years ago

StarpTech commented 6 years ago

Hi @wooorm,

currently, I have to manage some forks of your projects in order to deal with attributes in a less strict way. This situation was improved very well but right know I have still the problem to work with <template> nodes. A <template> node create an additional container #document-fragment and does not expose its children through children but content.

Do you have an idea how to deal with that in your util packages? My project based on your https://github.com/rehypejs/rehype-format project which use the parents.length to check the indentation depth but this information is broken since a template node is handled as a new document.

Are you open for an optional flag to handle a template node like any other element? e.g in

Purpose: for formatter, analyser which doesn't need such context of scoping but for much easier parsing. Problem: simple template nodes or nested template nodes.

StarpTech commented 6 years ago

Close it in favor of https://github.com/syntax-tree/hast/issues/10