fix: parse markdown list continuation prose#1478
Open
KirtiRamchandani wants to merge 1 commit into
Open
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Markdown scripts that contain two-space-indented list continuation prose can be parsed as executable code after a blank line. That matches the failure in #1388, where prose under a list item is emitted without a comment prefix. It also affects #1389, where an indented bash fence is transformed into malformed
$template-call output.Root cause
The markdown transformer treated any line starting with two or more spaces as an indented code block after an empty line. CommonMark indented code blocks require four spaces or a tab, while fenced blocks may still be indented by up to three spaces.
Solution
Only enter indented-code mode for four or more leading spaces or a tab. The existing fenced-code parser continues to handle fences indented by up to three spaces, so indented bash fences inside list content still transform correctly.
Fixes #1388
Fixes #1389
Tests
node --experimental-transform-types test/md.test.tsnpx prettier --check src\md.ts test\md.test.tsgit diff --check