Skip to content

Commit 2460571

Browse files
committed
Markdown: Ignore preambule at file start between --- lines
1 parent d0d780e commit 2460571

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ tags: ['code','python']
66
menu:
77
main:
88
parent: 'code'
9+
layout: default
910
---
1011

1112
# About this input

parsers/markdown.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ static void findMarkdownTags(void)
192192
char in_code_char = 0;
193193
long startSourceLineNumber = 0;
194194
long startLineNumber = 0;
195+
bool inPreambule = false;
195196

196197
nestingLevels = nestingLevelsNewFull(0, fillEndField);
197198

@@ -201,6 +202,16 @@ static void findMarkdownTags(void)
201202
bool line_processed = false;
202203
bool indented;
203204
int pos = get_first_char_pos(line, line_len, &indented);
205+
int lineNum = getInputLineNumber ();
206+
207+
if (lineNum == 1 || inPreambule)
208+
{
209+
if (line[pos] == '-' && line[pos + 1] == '-' && line[pos + 2] == '-')
210+
inPreambule = !inPreambule;
211+
}
212+
213+
if (inPreambule)
214+
continue;
204215

205216
for (int i = 0; i < 2 && !indented; i++)
206217
{

0 commit comments

Comments
 (0)