fix(magic blocks): ensure newline characters processed as hard breaks#1329
Conversation
processor/transform/mdxish/magic-blocks/magic-block-transformer.ts
Outdated
Show resolved
Hide resolved
- overall cleaner and better code structure
rafegoldberg
left a comment
There was a problem hiding this comment.
This only addresses non-whitespace prefixed line breaks in magic blocks,1 but the discrepancy between legacy and Xish still exists in all other contexts. The legacy engine had a custom compiler step that handled these breaks which we should replicate.
That said, I'm open to doing this in a separate PR if you prefer @maximilianfalco?
Footnotes
-
I've updated the title of this PR to reflect this limitation. ↩
|
Seems like we used to use the |
|
@rafegoldberg ohh didnt know we had that! thanks for the info! yea I'll give it a shot first, if the diffs arent that large, I think we can combine the fix for magic blocks and non magic blocks as well in this PR but if the diff is large, may have to just open a new PR |
|
it looks like integrating the remark-breaks plugin would solve this nicely and also close out this PR #1328 |
processor/transform/mdxish/magic-blocks/magic-block-transformer.ts
Outdated
Show resolved
Hide resolved
| const { processor, parserReadyContent } = mdxishAstProcessor(mdContent, opts); | ||
|
|
||
| processor | ||
| .use(remarkBreaks) |
|
Nice thanks for integrating the |
## Version 13.1.2 ### 🛠 Fixes & Updates * **magic blocks:** ensure newline characters processed as hard breaks ([#1329](#1329)) ([bb37d62](bb37d62)) * fix callout magic blocks when rendered directly below a list item ([#1331](#1331)) ([de2b82a](de2b82a)) * fix rendering content in table magic blocks ([#1318](#1318)) ([0ea1cfc](0ea1cfc)) * preserve recipe top level attributes in mdast ([#1324](#1324)) ([98f466b](98f466b)) * **stripComments:** properly pass in the micromark extensions ([#1335](#1335)) ([7ec9d46](7ec9d46)) * **mdxish:** properly terminate html blocks ([#1336](#1336)) ([d221861](d221861)) <!--SKIP CI-->
This PR was released!🚀 Changes included in v13.1.2 |

🧰 Changes
During some triage we saw that when newline characters are attached to the previous word, it doesnt get parsed properly as a hard break but instead as a soft break. this was the default behaviour of
remark-parseand is inherently different from how RDMD legacy processed these line breaks.this PR adds 2 things
remark-breaksto fully support legacy hard break behaviourHeres an after demo in the main ReadMe app after linking locally:

🧬 QA & Testing
Testing Source Code
Try typing something like the attached magic block source code and we should now register these as proper newlines