syntax-tree / hast-util-raw

utility to reparse a hast tree
https://unifiedjs.com
MIT License
11 stars 4 forks source link

Preserve tag name cases #25

Closed quadratz closed 3 months ago

quadratz commented 3 months ago

Initial checklist

Problem

Add an option to preserve the case of HTML tags. This is similar to issue https://github.com/syntax-tree/hast-util-raw/issues/18, but for HTML tags in general.

Currently, this

{
      "type": "raw",
      "value": "<TabGroup><Tab lang='js' title='JavaScript' /></TabGroup>",     
}

will yield

 {
      "type": "element",
      "tagName": "tabgroup",
      // ...
 }

Solution

TabGroup and Tab should be cased. It should produce this output instead

 {
      "type": "element",
      "tagName": "TabGroup",
      // ...
 }
ChristianMurphy commented 3 months ago

Welcome @quadratz! 👋 HTML is case insensitive, there are no plans to add non-html features to the HTML parser. It looks like you may be working with XML or JSX. If you are working with XML consider using https://github.com/syntax-tree/xast-util-from-xml If you are working with JSX+Markdown consider using https://mdxjs.com/

github-actions[bot] commented 3 months ago

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

quadratz commented 3 months ago

I think https://mdxjs.com/ is more suitable for my case. Thank you for the help.