-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Astro wrongly process markdown code #9909
Labels
- P3: minor bug
An edge case that only affects very specific usage (priority)
Comments
Can you submit a PR that fixes this? |
matthewp
added
- P3: minor bug
An edge case that only affects very specific usage (priority)
and removed
needs triage
Issue needs to be triaged
labels
Feb 1, 2024
remcohaszing
added a commit
to remcohaszing/astro
that referenced
this issue
Feb 13, 2024
`html` nodes from mdast are converted to `raw` hast nodes. These nodes are then not processed by proper rehype plugins. Typically if a remark plugin generates `html` nodes, this indicates it should have actually been a rehype plugin. This changes the remark plugins that generate `html` nodes into rehype nodes. These were `remarkPrism` and `remarkShiki`. Closes withastro#9909
remcohaszing
added a commit
to remcohaszing/astro
that referenced
this issue
Feb 13, 2024
`html` nodes from mdast are converted to `raw` hast nodes. These nodes are then not processed by proper rehype plugins. Typically if a remark plugin generates `html` nodes, this indicates it should have actually been a rehype plugin. This changes the remark plugins that generate `html` nodes into rehype nodes. These were `remarkPrism` and `remarkShiki`. Closes withastro#9909
ematipico
added a commit
that referenced
this issue
Mar 8, 2024
* fix(markdown): don’t generate mdast html nodes `html` nodes from mdast are converted to `raw` hast nodes. These nodes are then not processed by proper rehype plugins. Typically if a remark plugin generates `html` nodes, this indicates it should have actually been a rehype plugin. This changes the remark plugins that generate `html` nodes into rehype nodes. These were `remarkPrism` and `remarkShiki`. Closes #9909 * Apply suggestions from code review * refactor(mdx): move user defined rehype plugins after syntax highlighting * fix(mdx): fix issue in mdx rehype plugin ordering * docs: explain why html/raw nodes are avoided in changeset This also includes some hints on what users could do to upgrade of they rely on these nodes. * Fix MDX rehype plugin ordering * refactor(remark): restore remarkPrism and remarkShiki They aren’t used anymore, but removing would be a breaking change. * chore: mark deprecated * Apply suggestions from code review Co-authored-by: Sarah Rainsberger <[email protected]> * Update .changeset/thirty-beds-smoke.md Co-authored-by: Sarah Rainsberger <[email protected]> --------- Co-authored-by: Emanuele Stoppa <[email protected]> Co-authored-by: Bjorn Lu <[email protected]> Co-authored-by: Sarah Rainsberger <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
It looks like Astro preprocesses the hast in a way that’s incompatible with this plugin (other rehype plugins). rehype-mermaidjs searches for
<pre>
and<code>
elements, but Astro turns them into raw nodes. This is a bug in Astro. I suggest you open an issue there. Maybe you can work around it using rehype-raw.This bug was initially coded as remcohaszing/remark-mermaidjs#23 and later identified in remcohaszing/rehype-mermaid#10
(Citing @remcohaszing )
What's the expected result?
The processed hast should allow for a further processing by any
rehype
plugin.Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-ekqekg
Participation
The text was updated successfully, but these errors were encountered: