Hi! This issue is somewhat similar to #159, but specific to fenced code block highlighting.
When using tpope's vim-liquid (for instance when editing Markdown files with Liquid templates), the buffer filetype is set to liquid but actual syntax highlighting is delegated to syntax/markdown. And that works great, except for fenced code blocks.
How to reproduce
A minimal working example to reproduce the issue:
Install vim-markdown and vim-liquid
Edit a file named example.md with the following content
---
layout: post
tags: [foo, bar]
---
Example fenced block:
```vim
let g:foo = 'bar'
```
Expected result: The fenced code block is highlighted with vim syntax highligting.
Actual result: The fenced code block is highlighted as a generic mkdCode.
Issue
From what I see in ftplugin/markdown.vim, fenced blocks are only highlighted when filetype matches markdown, so that prevents it from running on liquid buffers. The filetype to match is hard-coded, so there is no way to customise this from the user's point of view.
It would be nice to extend this feature to support liquid files by checking the value of b:liquid_subtype. This way, the plugin would be compatible with vim-liquid out-of-the-box. I implemented this proposal in #609.
A more general solution could also be to add a setting variable that allows the user to enable MarkdownHighlightSources on a custom list of filetypes. That would be a viable alternative if you do not want to create any coupling at all with other plugins such as vim-liquid, and rather let the user sort the issue out through their own configuration. This might be an overkill however compared to just adding compatibility with vim-liquid (a fairly popular plugin from a well-known author), since it adds maintenance cost (new settings, documentation, etc.) and I am not sure how useful such setting would be outside of this specific use case.
Hi! This issue is somewhat similar to #159, but specific to fenced code block highlighting.
When using tpope's vim-liquid (for instance when editing Markdown files with Liquid templates), the buffer
filetype
is set toliquid
but actual syntax highlighting is delegated tosyntax/markdown
. And that works great, except for fenced code blocks.How to reproduce
A minimal working example to reproduce the issue:
vim-markdown
andvim-liquid
Edit a file named
example.md
with the following contentExpected result: The fenced code block is highlighted with
vim
syntax highligting. Actual result: The fenced code block is highlighted as a genericmkdCode
.Issue
From what I see in
ftplugin/markdown.vim
, fenced blocks are only highlighted whenfiletype
matchesmarkdown
, so that prevents it from running onliquid
buffers. Thefiletype
to match is hard-coded, so there is no way to customise this from the user's point of view.Proposed solution
It would be nice to extend this feature to support
liquid
files by checking the value ofb:liquid_subtype
. This way, the plugin would be compatible withvim-liquid
out-of-the-box. I implemented this proposal in #609.A more general solution could also be to add a setting variable that allows the user to enable
MarkdownHighlightSources
on a custom list of filetypes. That would be a viable alternative if you do not want to create any coupling at all with other plugins such asvim-liquid
, and rather let the user sort the issue out through their own configuration. This might be an overkill however compared to just adding compatibility withvim-liquid
(a fairly popular plugin from a well-known author), since it adds maintenance cost (new settings, documentation, etc.) and I am not sure how useful such setting would be outside of this specific use case.