# Markdown cells not rendering directives

Hello!

I am trying to render some {math} and {note} directives in my notebook but I can’t get them to render. The markdown is the following:

Single Dollar sign directive

$\hat{Y} = \hat{\beta}_{0} + \sum \limits _{j=1} ^{p} X_{j}\hat{\beta}_{j}$

-------------------------------

Double dollar sign:

$$w_{t+1} = (21 + r_{t+1}) s(w_t) + y_{t+1}$$

--------------------------------

Math directive

{math}

w_{t+1} = (12 + r_{t+1}) s(w_t) + y_{t+1}



-------------------------------

Inline math directive:

{math}x_{hey}=it+is^{math}

Since Pythagoras, we know that {math}a^2 + b^2 = c^2

-------------------------------

Latex math

$$\int_0^\infty \frac{x^3}{e^x-1}\,dx = \frac{\pi^4}{15}$$

-------------------------------

Note directive

note
this is supposed to be a note



I would expect the note and math formulas to render, but instead here is what I get:

Any ideas why only the Latex and dollar math are rendering, and the rest isn’t? I am not sure how to debug this as I am pretty new to Jupyter. (Note: this happens in both Jupyter Notebook as well as Jupyter Lab).

Troubleshoot info:

||jupyter-client 7.3.4|
||jupyter-core 4.11.1|
||jupyter-server 1.18.1|
||jupyterlab 3.4.5|
||jupyterlab-mathjax3 4.3.0|
||jupyterlab-pygments 0.2.2|
||jupyterlab-server 2.15.0|

I think that this is not a valid Markdown syntax. Plain JupyterLab uses marked.js which is compatible with CommonMark, GitHub Flavored Markdown and the original markdown.pl.

Adding syntax highlighting in CommonMark and GitHub Flavored Markdown is performed via text after backticks without the braces, see examples: CommonMark 142 and GFM 112, but I am not aware of standard syntax other than $ and $\$ which would typeset LaTeX in markdown. If you have a reference for such, please do provide!

What you are trying to do appears to be RMarkdown flavour. Unfortunately, contrary to universally accepted flavours, I could not find a formal specification for RMarkdown; it would make it easier to re-use if there was one making it a proper open standard. There are however already three options if you would like to use that format:

Personal opinion: I really wish that RStudio went for closer collaboration with existing standards (including Jupyter) rather than reinventing a wheel, but here we are.

2 Likes

This also looks a lot like MyST, although I’ve never seen a bare :::note directive (vs :::{note}). For MyST, as @krassowski notes, we do have a JupyterLab renderer: jupyterlab-myst · PyPI

You could try this latest pre-release (pip install --pre jupyterlab-myst) and see if it works for your use case.

2 Likes

Thanks for the replies. Seems like my confusion came from me reading the documentation of Jupyter Book thinking it was Jupyter Notebook. I wonder if there should be some warning on that documentation to disambiguate the two.

I tried the jupyterlab-myst · PyPI and it worked! So I think I will go with that one.

Thanks again!

1 Like