Describe the bug
EnrichedMarkdownText renders ordinary Markdown soft breaks as visual line breaks on native platforms. This makes wrapped Markdown content display differently from typical CommonMark/GFM web renderers.
To Reproduce
-
Render this content with EnrichedMarkdownText:
Let's start simple: keep taking your medications as prescribed, and we'll begin tracking your
blood sugar and blood pressure so we can see how you're really doing.
-
Observe the rendered text on iOS or Android.
-
A visible line break appears after your.
Expected behavior
A single newline within a paragraph is a Markdown soft break and should render as whitespace:
…we'll begin tracking your blood sugar and blood pressure…
Explicit hard breaks—two trailing spaces or a trailing backslash before the newline—should continue to render as visual line breaks.
Screenshots
Not applicable; the reproduction is visible from the supplied Markdown snippet.
Device (please complete the following information):
- Device: Reproduced in app; exact device model can be provided if needed
- OS: iOS / Android
- Version:
react-native-enriched-markdown@0.7.4
Additional context
The shared C++ parser currently maps both MD_TEXT_SOFTBR and MD_TEXT_BR to NodeType::LineBreak:
if (type == MD_TEXT_SOFTBR || type == MD_TEXT_BR) {
auto brNode = std::make_shared<MarkdownASTNode>(NodeType::LineBreak);
impl->addInlineNode(brNode);
return 0;
}
Suggested behavior:
if (type == MD_TEXT_SOFTBR) {
impl->currentText.append(" ");
return 0;
}
if (type == MD_TEXT_BR) {
auto brNode = std::make_shared<MarkdownASTNode>(NodeType::LineBreak);
impl->addInlineNode(brNode);
return 0;
}
Because this parser is shared native code, the issue affects both iOS and Android.
Describe the bug
EnrichedMarkdownTextrenders ordinary Markdown soft breaks as visual line breaks on native platforms. This makes wrapped Markdown content display differently from typical CommonMark/GFM web renderers.To Reproduce
Render this content with
EnrichedMarkdownText:Observe the rendered text on iOS or Android.
A visible line break appears after
your.Expected behavior
A single newline within a paragraph is a Markdown soft break and should render as whitespace:
Explicit hard breaks—two trailing spaces or a trailing backslash before the newline—should continue to render as visual line breaks.
Screenshots
Not applicable; the reproduction is visible from the supplied Markdown snippet.
Device (please complete the following information):
react-native-enriched-markdown@0.7.4Additional context
The shared C++ parser currently maps both
MD_TEXT_SOFTBRandMD_TEXT_BRtoNodeType::LineBreak:Suggested behavior:
Because this parser is shared native code, the issue affects both iOS and Android.