If you place one fenced code block within another, the highlighting of inner fenced code block and everything below it will be broken.
# heading 1
this is how fenced code blocks look:
```` markdown
``` vim
set syntax=ON
```
````
# heading 2
some text
see above
9.0
Windows 7
No response
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I can understand a ```vim or ```python fenced code block inside a markdown file, but does it make sense to have a ```markdown fenced code block inside a markdown file?
FWIW, I've just pushed a commit which fixes this issue on my fork.
In any case, if you want to discuss the issue with the maintainer, here is their issue tracker.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
FWIW, I've just pushed a commit which fixes this issue on my fork.
Why don't you use relative imports? They are known to be faster and do not add anything to startuptime.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@lacygoill "But does it make sense to have a Markdown fenced code block inside a Markdown file?" --- Yes, if your Markdown file is about the Markdown language itself (a tutorial, style guide, or something like this.)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Why don't you use relative imports? They are known to be faster and do not add anything to startuptime.
I only use them when necessary; i.e. in scripts under plugin/ (like here). They're less useful in filetype plugins, because those are not sourced on startup. Unless you start Vim with a lot of files; I usually don't.
You mean it will be better to duplicate the issue there so that the fix will be available for everyone in the next Vim release?
Even if we would find a fix here, it's up to the maintainer to decide how the issue should be fixed (if it should at all). Then, they send their changes to the Vim devs who merge them.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Even if we would find a fix here
Isn't it you have found that fix? ("FWIW, I've just pushed a commit which fixes this issue on my fork.")
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Isn't it you have already found that fix?
I don't know whether the fix for my fork would work on the original plugin. The latter includes other syntax plugins in a naive way: it doesn't save/restore the syntax option 'iskeyword', it doesn't clear syntax settings from included syntax plugins, it doesn't define any match for syncing, ...
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I've just realized you were not talking about fenced code blocks highlighted with their own syntax plugins. Just "regular" fenced code blocks. This patch should fix the issue then:
diff --git a/runtime/syntax/markdown.vim b/runtime/syntax/markdown.vim index 17b61c2fa..bc396e2d2 100644 --- a/runtime/syntax/markdown.vim +++ b/runtime/syntax/markdown.vim @@ -97,7 +97,7 @@ exe 'syn region markdownBoldItalic matchgroup=markdownBoldItalicDelimiter start= syn region markdownCode matchgroup=markdownCodeDelimiter start="`" end="`" keepend contains=markdownLineStart syn region markdownCode matchgroup=markdownCodeDelimiter start="`` \=" end=" \=``" keepend contains=markdownLineStart -syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*````*.*$" end="^\s*````*\ze\s*$" keepend +syn region markdownCode matchgroup=markdownCodeDelimiter start="^\s*\z(````*\).*$" end="^\s*\z1\ze\s*$" keepend syn match markdownFootnote "\[^[^\]]\+\]" syn match markdownFootnoteDefinition "^\[^[^\]]\+\]:"
However, I don't think it's necessary. I think the issue was already fixed in this commit.
So, the same comment as in the issue #10979 applies here:
I guess you'll have to wait for the default filetype plugin to be synchronized with upstream, or if you want an immediate fix, you could copy the updated filetype plugin on your local machine:
$ cd ~/.vim/ftplugin/ && curl --fail --location --show-error --silent --remote-name 'https://raw.githubusercontent.com/tpope/vim-markdown/master/ftplugin/markdown.vim'
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
so can we close it and leave it to @tpope to sync and update new markdown files?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@chrisbra Sure.
@lacygoill This is somewhat offtopic, but could you explain where to find repository for Vim CSS ftplugin and how this ftplugin works?
I see some errors there, for example, compare h1 with h2 or h3, but I cannot understand which code hightlights it so.
The contents of $VIMRUNTIME/ftplugin/css.vim is simply
" Vim filetype plugin file
" Language: CSS
" Maintainer: Doug Kearns <dougk...@gmail.com>
" Previous Maintainer: Nikolai Weibull <n...@bitwi.se>
" Last Change: 2020 Dec 21
if exists("b:did_ftplugin")
finish
endif
let b:did_ftplugin = 1
let s:cpo_save = &cpo
set cpo&vim
let b:undo_ftplugin = "setl com< cms< inc< fo< ofu< isk<"
setlocal comments=s1:/*,mb:*,ex:*/ commentstring&
setlocal formatoptions-=t formatoptions+=croql
setlocal omnifunc=csscomplete#CompleteCSS
setlocal iskeyword+=-
let &l:include = '^\s*@import\s\+\%(url(\)\='
let &cpo = s:cpo_save
unlet s:cpo_save
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Closed #11026 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
The contents of $VIMRUNTIME/ftplugin/css.vim is simply
If the issue is related to highlighting, then you need to find the syntax plugin, and its maintainer.
The repo should be here.
I can't reproduce the highlighting on this screenshot. However, you can inspect the stack of syntax items under the cursor with this Ex command:
:vim9 echo synstack('.', col('.'))->map((_, id) => id->synIDattr('name'))
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()