In writing markdown files, I may use code blocks with ``` and `. Is there a way I can use code highlighting and checking on just the code blocks inside markdown files?
1 Answer
If you use default markdown filetype which is bundled with vim (tpope's markdown):
- make sure you have
let g:markdown_fenced_languages = ['dart', 'python', 'ruby', 'go']
in your vimrc. This is the list of vim filetypes to be highlighted in markdown. Of course, your list would be different. - in your markdown file use code blocks with filetypes.
Example:
```python
def hello():
print("hello world")
```