Skip to content

Commit

Permalink
Merge pull request #3626 from masatake/markdown--3625
Browse files Browse the repository at this point in the history
Markdown: fix the condition to detect code blocks
  • Loading branch information
masatake committed Jan 9, 2023
2 parents 20f1247 + 8b269f9 commit c7daaa3
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Units/parser-markdown.r/code-block-under-items.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--sort=no
--extras=+g
--fields=+{language}
10 changes: 10 additions & 0 deletions Units/parser-markdown.r/code-block-under-items.d/expected.tags
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions Units/parser-markdown.r/code-block-under-items.d/input.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!-- Taken from #3625 submitted by @jiz4oh -->
# 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()
{
:
}
```
2 changes: 1 addition & 1 deletion parsers/markdown.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit c7daaa3

Please sign in to comment.