Skip to content

Commit 3ec4209

Browse files
committed
Markdown: Make sure quotes (starting with >) aren't used as headers when underlined
1 parent 35c6034 commit 3ec4209

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

Units/parser-markdown.r/simple-markdown.d/expected.tags

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ F input.md /^F$/;" s chapter:C end:106 sectionMarker:-
2828
G input.md /^ G$/;" s chapter:C end:109 sectionMarker:-
2929
H input.md /^ H$/;" s chapter:C end:112 sectionMarker:-
3030
I input.md /^ I$/;" s chapter:C end:128 sectionMarker:-
31-
C\\# input.md /^# C\\#$/;" c end:143 sectionMarker:#
31+
C\\# input.md /^# C\\#$/;" c end:146 sectionMarker:#
3232
J input.md /^J$/;" s chapter:C\\# end:133 sectionMarker:-
3333
K input.md /^K$/;" s chapter:C\\# end:136 sectionMarker:-
34-
L input.md /^L$/;" s chapter:C\\# end:143 sectionMarker:-
34+
L input.md /^L$/;" s chapter:C\\# end:146 sectionMarker:-
3535
x input.md /^function x$/;" f
3636
y input.md /^function y$/;" f
3737
z input.md /^z()$/;" f

Units/parser-markdown.r/simple-markdown.d/input.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,6 @@ ignored
141141
-
142142

143143
```foo```
144+
145+
> quoted
146+
---

parsers/markdown.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,16 @@ static void findMarkdownTags(void)
256256
line_processed = true;
257257

258258
/* if it's a title underline, or a delimited block marking character */
259-
else if (line[pos] == '=' || line[pos] == '-' || line[pos] == '#')
259+
else if (line[pos] == '=' || line[pos] == '-' || line[pos] == '#' || line[pos] == '>')
260260
{
261261
int n_same;
262262
for (n_same = 1; line[n_same] == line[pos]; ++n_same);
263263

264+
/* quote */
265+
if (line[pos] == '>')
266+
; /* just to make sure line_processed = true so it won't be in a heading */
264267
/* is it a two line title */
265-
if (line[pos] == '=' || line[pos] == '-')
268+
else if (line[pos] == '=' || line[pos] == '-')
266269
{
267270
char marker[2] = { line[pos], '\0' };
268271
int kind = line[pos] == '=' ? K_CHAPTER : K_SECTION;

0 commit comments

Comments
 (0)