QuantEcon / sphinxcontrib-jupyter

A Sphinx Extension for Generating Jupyter Notebooks
BSD 3-Clause "New" or "Revised" License
76 stars 23 forks source link

Code highlighting with backticks #104

Closed natashawatkins closed 5 years ago

natashawatkins commented 6 years ago

It doesn't appear that text in rst enclosed in backticks is being highlighted.

mmcky commented 6 years ago

@natashawatkins can you give me some examples? The inline is typically rendered as a gray cell around the contents.

Also markdown only typically supports rendering using fenced code blocks using three backticks. https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting

We could probably add this as a custom feature but I think they would need to be included as inline html markup

natashawatkins commented 5 years ago

So the issue is the sphinx converted is somehow getting rid of the backticks, because the backticks do work in a Jupyter notebook. See for example from the numpy lecture...

screen shot 2018-09-24 at 3 37 18 pm screen shot 2018-09-24 at 3 37 39 pm

The above picture I added a cell with what Jupyter notebook renders with backticks

mmcky commented 5 years ago

thanks @natashawatkins that example is helpful. I will dig into this on Monday.

mmcky commented 5 years ago

hey @natashawatkins I think you'll find the source has a single backtick for the ones that aren't highlighted. For inline code examples you can use two backticks as per the sphinx documentation http://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html This is technically an in line literal markup but that is typically all that is required.

We could support inline roles using single backticks if we need to but probably isn't adding much value for the highlighting.

natashawatkins commented 5 years ago

I think we should support it because that's how nearly all highlighting is done in the currest rst files

natashawatkins commented 5 years ago

I updated jupinx and this has now been fixed