diff --git a/Units/parser-markdown.r/code-block-under-items.d/args.ctags b/Units/parser-markdown.r/code-block-under-items.d/args.ctags new file mode 100644 index 0000000000..b0e82ad0fa --- /dev/null +++ b/Units/parser-markdown.r/code-block-under-items.d/args.ctags @@ -0,0 +1,3 @@ +--sort=no +--extras=+g +--fields=+{language} diff --git a/Units/parser-markdown.r/code-block-under-items.d/expected.tags b/Units/parser-markdown.r/code-block-under-items.d/expected.tags new file mode 100644 index 0000000000..4bb987c49b --- /dev/null +++ b/Units/parser-markdown.r/code-block-under-items.d/expected.tags @@ -0,0 +1,10 @@ +test input.md /^# test$/;" c language:Markdown +department2 input.md /^ create table department2($/;" t language:SQL +id input.md /^ id int primary key,$/;" E language:SQL table:department2 +name input.md /^ name varchar(20),$/;" E language:SQL table:department2 +comment input.md /^ comment varchar(100)$/;" E language:SQL table:department2 +department3 input.md /^ create table department3($/;" t language:SQL +id input.md /^ id int,$/;" E language:SQL table:department3 +name input.md /^ name varchar(20),$/;" E language:SQL table:department3 +comment input.md /^ comment varchar(100),$/;" E language:SQL table:department3 +foo input.md /^ foo()$/;" f language:Sh diff --git a/Units/parser-markdown.r/code-block-under-items.d/input.md b/Units/parser-markdown.r/code-block-under-items.d/input.md new file mode 100644 index 0000000000..a36619bb7c --- /dev/null +++ b/Units/parser-markdown.r/code-block-under-items.d/input.md @@ -0,0 +1,29 @@ + +# test + +- primary key: + + ```sql + # method 1 + create table department2( + id int primary key, + name varchar(20), + comment varchar(100) + ); + + # method 2 + create table department3( + id int, + name varchar(20), + comment varchar(100), + constraint pk_name primary key(id); + ``` + +- second key: + + ```sh + foo() + { + : + } + ``` diff --git a/parsers/markdown.c b/parsers/markdown.c index 441b7d2bcb..e077fbe2b4 100644 --- a/parsers/markdown.c +++ b/parsers/markdown.c @@ -283,7 +283,7 @@ static void findMarkdownTags (void) char c = line[pos]; char otherC = c == '`' ? '~' : '`'; int nSame; - for (nSame = 1; line[nSame] == line[pos]; ++nSame); + for (nSame = 1; line[nSame + pos] == line[pos]; ++nSame); if (inCodeChar != otherC && nSame >= 3) {