-
Notifications
You must be signed in to change notification settings - Fork 386
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
[Question] Combine default markdown syntax and vimtex syntax? #2874
Comments
I believe the problem is quite simple. You forgot to if exists('b:current_syntax')
finish
endif
runtime! syntax/markdown.vim
unlet b:current_syntax
" Include tex math in markdown
syn include @tex syntax/tex.vim
syn region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
syn region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
let b:current_syntax = 'markdown' |
@lervag That does not work, also the if exists('b:current_syntax') || exists('b:_loaded_markdown_syntax')
finish
endif
let b:_loaded_markdown_syntax = 1
runtime! syntax/markdown.vim
unlet b:current_syntax
" Include tex math in markdown
syn include @tex syntax/tex.vim
syn region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
syn region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend
let b:current_syntax = 'markdown' and this is what I get -- all highlighting in markdown math zone disappears (e.g. it does not make a difference before/after adding |
I've also tried moving the syntax file to the syn include @tex syntax/tex.vim
syn region mkdMath start="\\\@<!\$" end="\$" skip="\\\$" contains=@tex keepend
syn region mkdMath start="\\\@<!\$\$" end="\$\$" skip="\\\$" contains=@tex keepend but that does not give me math conceal in mathzones. Don't know why but the conceal works only if
So it seems that the math concealing works only if nvim does not source the default markdown syntax file. I'm confused. |
Description
Some background:
I want to combine the default markdown syntax and vimtex syntax, more specifically
So I create
~/.config/nvim/syntax/markdown.vim
like the following:and it works great, now I have math cancellation in makrdown math zones:
However, as you see many other syntax elements, e.g. the header is not highlighted because I do not define them in the syntax file, so I source the nvim's default markdown syntax file in my custom syntax file:
Now I have syntax highlights from nvim's default syntax file, but the math zone isn't concealed anymore:
So I wonder where I did wrong and how I can have default markdown highlighting combined with vimtex's math conceal feature using a custom markdown syntax file? Thanks in advance!
Steps to reproduce
No response
Expected behavior
No response
Actual behavior
No response
Do you use a latexmkrc file?
No
VimtexInfo
Cannot use `:VimtexInfo` in markdown files.
The text was updated successfully, but these errors were encountered: