syntax-tree / hast-util-to-dom

utility to transform hast to a DOM tree
https://unifiedjs.com
ISC License
19 stars 8 forks source link

Difference between `hast-util-to-dom` and `hast-util-to-html` results #1

Closed Hypercubed closed 5 years ago

Hypercubed commented 5 years ago

Looks like rehype-stringify and rehype-dom-stringify handle element attributes inconsistently. Looks to me that Rehype converts attributes with hyphens (i.e. data-test) to camel case (dataTest). rehype-stringify handles this correctly when generating the string but looks to me like rehype-dom-stringify is not.

See here: https://repl.it/@Hypercubed/GrubbySneakyBlogclient

Hypercubed commented 5 years ago

Here are relevant tests in hast-util-to-html: https://github.com/syntax-tree/hast-util-to-html/blob/master/test/attribute.js#L512

kmck commented 5 years ago

Thanks for the heads up! Fixed in https://github.com/syntax-tree/hast-util-to-dom/commit/f1f7d324df30c3ff6a2ddcc3cfaf387d87627b62