Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ^\s*```$ for mkdCodeEnd #522

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomtomjhj
Copy link
Contributor

Some languages use markdown style fenced code block for documenting examples. Current pattern for mkdCodeEnd breaks that.

Current:
image

Fixed:
image

@@ -819,7 +819,7 @@ function! s:MarkdownHighlightSources(force)
else
let include = '@' . toupper(filetype)
endif
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s.*$" matchgroup=%s end="\s*```$" keepend contains=%s%s'
let command = 'syntax region %s matchgroup=%s start="^\s*```\s*%s.*$" matchgroup=%s end="^\s*```$" keepend contains=%s%s'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rebase this to the latest commit? #534 made some changes to this line.

Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about situations such as code blocks in block quotes? This is valid markdown in many/most parsers is it not?

> This is a block quote with a nested code block
>
> ```lua
> local example = "foo"
> ```
>
> Rest of block quote.

I'm a little confused why this example doesn't seem to be broken prior to this PR. The GitHub highlighting is off, but in VIM the whole thing is just a block quote. Are we not catching those at all? And it does seem there is something else wrong because this paragraph after the blockquote is not the same syntax group as the top one in this comment...

20230919_13h06m49s_grim

@lggruspe
Copy link
Contributor

I'm a little confused why this example doesn't seem to be broken prior to this PR. The GitHub highlighting is off, but in VIM the whole thing is just a block quote. Are we not catching those at all?

It's a bug in mkdBlockquote. It doesn't recognize code blocks or even italics (#583).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants