fix(content): use property-information
to convert hast attributes
#359
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix props rendering in
nuxt-content
component.Types of changes
Description
The issue is in the
nuxt-content
component when rendering the AST tree with Vue.js, specific prop needed to stay in camelCase when others needed to be transformed back to kebab-case.To fix #139, we forced
camelCase
props to kebab-case to ensureariaHidden
was rendered asaria-hidden
. But then with #309,<video autoplay ...>
was transformed to{ autoPlay: true }
in the tree (HAST spec, see also property-information code) and then rendered toauto-play
because of the module forcing kebab-case.To transform markdown to AST, we use
remark
andrehype
, to handle embedded HTML we use rehype-raw which under the hood use property-information that allows to convert HAST properties.This PR takes advantage of the
property-information
package to render props as their original html name. It adds 30kb inside the client package but I feel like we don't have a choice here.