-
Notifications
You must be signed in to change notification settings - Fork 70
fix: soft markdown line breaks #585
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
14b960e
fix: soft markdown line breaks
eszlamczyk 95c98a3
fix: removed uneccessary file
eszlamczyk 8ec8875
fix: add rebuilded wasm
eszlamczyk f8d7cb7
Merge branch 'main' into fix/541/markdown-parser-fixes
eszlamczyk 6bf40ea
feat: fix + docs
eszlamczyk dc6e2ed
test: maestro tests
eszlamczyk 3bcf944
fix: apply cr
eszlamczyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
.maestro/enrichedMarkdownText/flows/basic/block_elements/hard_break_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| appId: swmansion.enriched.markdown.example | ||
| tags: | ||
| - smoke | ||
| - block | ||
| - paragraph | ||
| - text | ||
| --- | ||
| # A trailing backslash is a CommonMark hard break: it forces a line break while | ||
| # staying inside one paragraph, so the two lines are separated by line height | ||
| # only. The blank line then starts a second paragraph that carries paragraph | ||
| # margins — the screenshot pins the spacing difference between the two. | ||
| - launchApp | ||
|
|
||
| - runFlow: | ||
| file: '../../../../subflows/move_to_playground.yaml' | ||
|
|
||
| - runFlow: | ||
| file: '../../../subflows/set_enriched_text_value.yaml' | ||
| env: | ||
| VALUE: | | ||
| This line ends with a backslash\ | ||
| so this text continues inside the same paragraph. | ||
|
|
||
| A blank line starts a new paragraph with its own spacing. | ||
|
|
||
| - runFlow: | ||
| file: '../../../subflows/capture_or_assert_screenshot.yaml' | ||
| env: | ||
| SCREENSHOT_NAME: 'hard_break_display' |
26 changes: 26 additions & 0 deletions
26
.maestro/enrichedMarkdownText/flows/basic/block_elements/soft_break_test.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| appId: swmansion.enriched.markdown.example | ||
| tags: | ||
| - smoke | ||
| - block | ||
| - paragraph | ||
| - text | ||
| --- | ||
| # Regression for #541: a single newline inside a paragraph is a CommonMark soft | ||
| # break and renders as a space — both lines flow together into one wrapped | ||
| # paragraph with no forced line break after "your". | ||
| - launchApp | ||
|
|
||
| - runFlow: | ||
| file: '../../../../subflows/move_to_playground.yaml' | ||
|
|
||
| - runFlow: | ||
| file: '../../../subflows/set_enriched_text_value.yaml' | ||
| env: | ||
| VALUE: | | ||
| 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. | ||
|
|
||
| - runFlow: | ||
| file: '../../../subflows/capture_or_assert_screenshot.yaml' | ||
| env: | ||
| SCREENSHOT_NAME: 'soft_break_display' |
Binary file added
BIN
+35.1 KB
.maestro/enrichedMarkdownText/screenshots/android/hard_break_display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+41.6 KB
.maestro/enrichedMarkdownText/screenshots/android/soft_break_display.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...d-markdown/ui/src/main/java/com/swmansion/enriched/markdown/renderer/SoftBreakRenderer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.swmansion.enriched.markdown.renderer | ||
|
|
||
| import android.text.SpannableStringBuilder | ||
| import com.swmansion.enriched.markdown.parser.MarkdownASTNode | ||
|
|
||
| class SoftBreakRenderer : NodeRenderer { | ||
| override fun render( | ||
| node: MarkdownASTNode, | ||
| builder: SpannableStringBuilder, | ||
| onLinkPress: ((String) -> Unit)?, | ||
| onLinkLongPress: ((String) -> Unit)?, | ||
| factory: RendererFactory, | ||
| ) { | ||
| builder.append(" ") | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
...kdown/android/src/main/java/com/swmansion/enriched/markdown/renderer/SoftBreakRenderer.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| package com.swmansion.enriched.markdown.renderer | ||
|
|
||
| import android.text.SpannableStringBuilder | ||
| import com.swmansion.enriched.markdown.parser.MarkdownASTNode | ||
|
|
||
| class SoftBreakRenderer : NodeRenderer { | ||
| override fun render( | ||
| node: MarkdownASTNode, | ||
| builder: SpannableStringBuilder, | ||
| onLinkPress: ((String) -> Unit)?, | ||
| onLinkLongPress: ((String) -> Unit)?, | ||
| factory: RendererFactory, | ||
| ) { | ||
| builder.append(" ") | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.