diff --git a/src/Tokenizer.ts b/src/Tokenizer.ts index a214bac4..f2707de6 100644 --- a/src/Tokenizer.ts +++ b/src/Tokenizer.ts @@ -270,7 +270,16 @@ export class _Tokenizer { // After a space the marker consumes it whole, so later tabs stay literal. .replace( this.rules.other.blockquoteMarkerWhitespace, - (_, marker: string, whitespace: string) => marker + expandTabs(whitespace, marker.length), + (_: string, marker: string, whitespace: string) => { + // The optional space after ">" is marker; anything after that is + // content (e.g. a tab that opens a fenced code line) and must not + // be expanded. Tabs with no leading space are structural and are + // expanded so indented code under the quote still works. + if (whitespace.startsWith(' ')) { + return marker + ' ' + whitespace.slice(1); + } + return marker + expandTabs(whitespace, marker.length); + }, ) // precede setext continuation with 4 spaces so it isn't a setext .replace(this.rules.other.blockquoteSetextReplace, '\n $1') diff --git a/test/specs/new/blockquote_fenced_code_tab.html b/test/specs/new/blockquote_fenced_code_tab.html new file mode 100644 index 00000000..aab76e90 --- /dev/null +++ b/test/specs/new/blockquote_fenced_code_tab.html @@ -0,0 +1,5 @@ +
+
class P:
+	name: str
+
+
diff --git a/test/specs/new/blockquote_fenced_code_tab.md b/test/specs/new/blockquote_fenced_code_tab.md new file mode 100644 index 00000000..ee96cd80 --- /dev/null +++ b/test/specs/new/blockquote_fenced_code_tab.md @@ -0,0 +1,7 @@ +--- +renderExact: true +--- +> ```python +> class P: +> name: str +> ```