Comments (3)
Sorry for not responding to this earlier. Life, and such.
Can't seem to reproduce this?
<ReactMarkdown source="Espen *initiated* this, but has had several **contributors**", allowedTypes={['Text', 'Paragraph']}, unwrapDisallowed />
Renders:
<p>Espen initiated this, but has had several contributors</p>
Emphasis
andStrong
are not part of the allowed types, but the text node children are unwrapped.If you have a reproducible test case, please comment and I'll reopen.
Just pitching in to let you know that I'm experiencing a similar problem.
Version 4.0.6.
Problem: If my source starts with 4 whitespaces, it will be treated as code
and disappear.
Eg.
<ReactMarkdown
source=" Test sentence.",
allowedTypes={['Text', 'Paragraph']},
unwrapDisallowed
/>
Expected output:
<p>Test sentence</p>
Actual Output:
<p></p>
My dirty fix:
<ReactMarkdown
source={source}
allowedTypes={['text', 'paragraph', 'code']}
renderers={{code: () => source}}
unwrapDisallowed
/>
Returns the expected output.
from react-markdown.
Sorry for not responding to this earlier. Life, and such.
Can't seem to reproduce this?
<ReactMarkdown
source="Espen *initiated* this, but has had several **contributors**",
allowedTypes={['Text', 'Paragraph']},
unwrapDisallowed
/>
Renders:
<p>Espen initiated this, but has had several contributors</p>
Emphasis
and Strong
are not part of the allowed types, but the text node children are unwrapped.
If you have a reproducible test case, please comment and I'll reopen.
from react-markdown.
Just getting around to playing around with this project again, hence the slow response. It still seems to occur in v2.4.2. Apologies, I should have added my test case to the OP.
<ReactMarkdown
source="_You_ want to tell me, and I have no objection to hearing it."
containerTagName="span"
unwrapDisallowed={true}
allowTypes={['Emph']}
escapeHtml={true}
/>
Renders (incorrectly):
<span>
<p>
<em>You</em> want to tell me, and I have no objection to hearing it.”
</p>
</span>
I wouldn't expect that the <p>
tags would be there as I have not explicitly allowed Paragraph in allowTypes
.
Instead, I have to accomplish this like so:
<ReactMarkdown
source="_You_ want to tell me, and I have no objection to hearing it."
containerTagName="span"
unwrapDisallowed={true}
disallowedTypes={['Paragraph']}
escapeHtml={true}
/>
Renders (correctly):
<span>
<em>You</em> want to tell me, and I have no objection to hearing it.”
</span>
Using allowTypes
is a far safer approach so I'd much prefer to use that if I can.
from react-markdown.
Related Issues (20)
- Custom Components Always Re-rendered HOT 4
- Not compatible to Chrome 90 or older HOT 11
- How to append content ,not cover? HOT 2
- When using two **enclosed bold texts containing colons, react-markdown fails to correctly parse the bold syntax. HOT 3
- Please add syntax for `{.tabset} ` HOT 2
- Typescript error while using syntax hightlight part code from README.md HOT 4
- sup element rendering with remark-gfm plugin is painfully slow. HOT 7
- React 18.3.0/19.0.0 support for react-markdown ^6.0.0 HOT 2
- React-markdown isn't rendering phone number links anymore HOT 3
- rst support HOT 2
- Can't drag-over select text to copy a section HOT 3
- Headings and subheadings aren't getting rendered (NextJS 14/ChakraUI) HOT 3
- Invalid HTML syntax together with `rehype-raw` causes crash HOT 6
- Incorrect Languageless Code Block Rendering in Example HOT 12
- Identify `last-child` HOT 3
- Compatible with lower version browsers HOT 3
- TypeError: (0 , unist_util_visit__WEBPACK_IMPORTED_MODULE_1__.visit) is not a function HOT 3
- Syntex for showing underlined text HOT 3
- would it be avaliable for yarn HOT 2
- Support Automatic Link Detection and Hyperlinking HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-markdown.