-
-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to enable remark-slug plugin? #397
Comments
I think it would be
which is essentially the same as your example. I have the same working using the remark-toc plugin |
Hey @shyaniv7, thanks for helping out. Unfortunately, I believe what you are suggesting is identical to using |
Hey @sunknudsen, if what youre trying to do is add id="" to your tags check out my answer here #404 you can override the heading node renderer |
Thanks for sharing @shyaniv7. I ended up overriding the heading as you suggested but using github-slugger. interface HeadingProps {
level: number
children: JSX.Element[]
}
const Heading: FunctionComponent<HeadingProps> = function(props) {
return React.createElement(
`h${props.level}`,
{
id: slug(props.children[0].props.children),
},
props.children
)
} |
I have the same problem. Tracked it down to the renderers as well. It seems the data field on nodes is just ignored and not added to the prop set. Is there a specific reason for that @rexxars? I could provide a feature to allow, at least a few importand and react safe attributes from node.data. |
The following code doesn’t throw an error but id’s are not added to headings.
Also tried
plugins={[[require("remark-slug")]]}
.The text was updated successfully, but these errors were encountered: