-
-
Notifications
You must be signed in to change notification settings - Fork 876
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
rehype-attr plugin not working #758
Comments
Welcome @eoinmurphy! 👋 To enable HTML see https://github.com/remarkjs/react-markdown#appendix-a-html-in-markdown |
This comment has been minimized.
This comment has been minimized.
Thanks for the quick response, @ChristianMurphy! I've just added Here's what's in my Markdown editor in Strapi: 1.
Npm stands for *node* <!--rehype:style=color: red--> package manager.
2.
Npm stands for <em class="test">node</em> package manager.
3.
Npm stands for *node*<!--rehype:class=test--> package manager. But each result in the following: <!-- 1 -->
<p>Npm stands for <em>node</em> <!-- --> package manager.</p>
<!-- 2, 3 -->
<p>Npm stands for <em>node</em> package manager.</p> I've also updated the CodeSandbox to show this behavior. Am I missing something silly here? |
|
Ah, that was it, I have it working now on my project. I also ran Thanks so much for the help! |
Initial checklist
Affected packages and versions
8.0.7
Link to runnable example
https://codesandbox.io/p/sandbox/bold-water-s8v68v?file=%2Fsrc%2FApp.js%3A14%2C1
Steps to reproduce
(This example is based on the
rehype-attr
examples)Attempt to render the below Markdown string using
react-markdown
with therehype-attr
plugin:Runtime: Node 18.12.0
I did search for past issues related to this, but couldn't find any.
Expected behavior
I expect the HTML output of this parsed Markdown to be
Actual behavior
The following is rendered in the body:
Npm stands for node <!--rehype:style=color: red--> package manager.
Looking at the outputted HTML:
It seems like it's trying to take the HTML comment into account, but renders two empty comments within the
<p>
tag instead.Note: I'm getting the Markdown from Strapi and then passing the
body
of that API response intoreact-markdown
. I've inspected the values received from the API in the console and all looks to be as expected:Runtime
No response
Package manager
yarn 1
OS
macOS
Build and bundle tools
Next.js
The text was updated successfully, but these errors were encountered: