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?

  • what is "checking on just the code blocks"? – Maxim Kim Mar 18 at 4:13
3

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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