fix: handle indented code fences in markdown transformation#1418
Closed
fresh3nough wants to merge 1 commit intogoogle:mainfrom
Closed
fix: handle indented code fences in markdown transformation#1418fresh3nough wants to merge 1 commit intogoogle:mainfrom
fresh3nough wants to merge 1 commit intogoogle:mainfrom
Conversation
7 tasks
Collaborator
|
There are a lot of pitfalls here. I'll take care of it myself. CC @Illuminati9 |
Collaborator
|
Superseded by #1419 |
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.
Fixes #1389
Problem
Running
zx --verboseon a markdown file containing code fences indented inside list items (e.g. with 2 spaces) causes aTypeError: $(...) is not a function.The
transformMarkdown()parser checks for tab-indentation (tabRe) before checking for code fences (codeBlockRe). When a fenced code block is indented with 2+ spaces (common inside list items), the tab check matches first and the line is emitted as raw code rather than being recognized as a bash/js fence. The raw backticks in the output produce invalid JavaScript.How to reproduce
Create a markdown file with a code fence inside a list item:
node --experimental-transform-types --test test/md.test.ts
md
transformMarkdown()
transformMarkdown() handles indented code fences in list items (#1389)
tests 2, pass 2, fail 0