Configuring JupyterLab Markdown highlighter to support MyST

Hi All,

I am starting to fully write my notebooks in MyST to be used with jupyter-book. For that, I create a markdown file, attach a Console Editor to my file, and do my thing, and it is working pretty well. However, in order to instruct jupyter-book to run a cell, the syntax used is:

```{code-cell} python3
print("Hello World");
```

Jupyterlab Markdown editor doesn’t understand that this is a python cell, and doesn’t highlight the code. However, it does if I instead of {code-cell} python3 use just python:

Screen Shot 2020-11-04 at 2.46.58 PM

Is there any way to tell the editor that {code-cell} python3 should be highlighted as python?

1 Like

I have the same issue. I want to publish my jupyter-notebooks using jupyterbook. At the same time, I want to be able to show them in jupyter lab. This works perfectly fine as long as I don’t use MyST syntax.
However, using MyST syntax, to eg. create a figure with a caption, looks good in the published jupyterbook but bad in jupyter lab:

```{figure} image.jpg
:height: 300px
:name: Tree

Caption text here...
```

This is how it looks in jupyterbook:

image

In jupyter lab it only shows this:

:height: 300px
:name: Tree

Caption text here...

Is there a way, to make jupyter lab show markdown-cells using MyST syntax correctly? (Like in jupyterbooks)?

1 Like

Is this similar to this: How to over-ride the markdown parser? · Issue #8668 · jupyterlab/jupyterlab · GitHub

I have been using Jupyter Books more and more, finding it so useful. Being able to preview MyST markdown within JupyterLab would indeed be very nice!

Brent

There is now a jupyterlab-myst extension. It’s not on pypi yet, but soon hopefully!

3 Likes

Yeh so basically the VS Code extension is currently a bit “further on” in terms of rendering ability of MyST Markdown: MyST-Markdown - Visual Studio Marketplace, and allows for things like displaying figures (you can even play around with some of the rendering online with e.g. markdown-it-docutils - demonstrator)

and then hopefully we will soon be working on parity and even more improvements with the jupyterlab-myst extension

On the topic of syntax highlighting, this is something we need to look at in ‘jupyterlab-markup’. I can’t recall having checked, but doesn’t the directives plugin handle things like figures already?

Hey @agoose77, I’ve opened Use new markdown-it plugins · Issue #8 · executablebooks/jupyterlab-myst · GitHub about updating it