Skip to content

Commit fb33d8a

Browse files
authored
Callouts should not be parsed from nested code blocks (#120)
1 parent 6ddd7a6 commit fb33d8a

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

docs/source/markup/callout.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ project:
1313
content: CC-BY-4.0 <1>
1414
subject: MyST Markdown
1515
```
16+
1. The license
1617
1718
1819
### C#

docs/source/markup/substitutions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ Substitutions should work in code blocks too.
1818
```{code} sh
1919
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{{version}}-linux-x86_64.tar.gz
2020
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-{{version}}-linux-x86_64.tar.gz.sha512
21-
shasum -a 512 -c elasticsearch-{{version}}-linux-x86_64.tar.gz.sha512 <1>
21+
shasum -a 512 -c elasticsearch-{{version}}-linux-x86_64.tar.gz.sha512
2222
tar -xzf elasticsearch-{{version}}-linux-x86_64.tar.gz
23-
cd elasticsearch-{{version}}/ <2>
23+
cd elasticsearch-{{version}}/
2424
```
2525

2626

src/Elastic.Markdown/Myst/CodeBlocks/EnhancedCodeBlockParser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ public override bool Close(BlockProcessor processor, Block block)
9494
span = lines.Lines[index].Slice.AsSpan();
9595
}
9696

97+
if (codeBlock.OpeningFencedCharCount > 3)
98+
continue;
99+
97100
var matchClassicCallout = CallOutParser.CallOutNumber().EnumerateMatches(span);
98101
var callOut = EnumerateAnnotations(matchClassicCallout, ref span, ref callOutIndex, originatingLine, false);
99102

0 commit comments

Comments
 (0)