1

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
  • what is "checking on just the code blocks"?
    – Maxim Kim
    Commented Mar 18, 2020 at 4:13

1 Answer 1

5

If you use default markdown filetype which is bundled with vim (tpope's markdown):

  1. 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.
  2. in your markdown file use code blocks with filetypes.

Example:

```python
def hello():
    print("hello world")
```

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.