numirias / semshi

🌈 Semantic Highlighting for Python in Neovim
1.02k stars 33 forks source link

Support for fenced codeblocks in markdown #125

Open monneyboi opened 2 years ago

monneyboi commented 2 years ago

At the moment, i'm working with some people that are into jupyter notebooks, but editing python in a web-GUI instead of vim seems bizarre to me. With jupytext and jupytext.vim i'm able to automatically convert notebooks to markdown and vice versa. The GUI people can use their GUI stuff, and i can continue living in the shell, everyone wins.

Jupytext embeds python in markdown as fenced codeblocks. notebook.md:

  1 ---
  2 jupyter:
.....
 11 ---
 12 
 13 ### Imports
 14
 15 ```python
 16 import os
 17 import pandas as pd
 18 import json
 19 ```

Vim supports highlighting these fenced blocks: init.vim

let g:markdown_fenced_languages = ['python']

But this will use the default highlighting engine instead of semshi's. Also, when i use :Semshi enable, semshi fails on the first line with:

Syntax error: invalid syntax (1, 4)

Is there a way to enable semshi for fenced codeblocks in markdown files?