Skip to content

Commit

Permalink
Disable automatic highlighting in notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Feb 28, 2021
1 parent 58c84ba commit e2021ca
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 30 deletions.
3 changes: 0 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
'sphinx_last_updated_by_git', # get "last updated" from Git
]

# Default language for syntax highlighting in reST and Markdown cells:
highlight_language = 'none'

# Don't add .txt suffix to source files:
html_sourcelink_suffix = ''

Expand Down
28 changes: 1 addition & 27 deletions doc/usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,28 +116,6 @@
"* `'sphinx_gallery.load_style'` to load CSS styles for [thumbnail galleries](subdir/gallery.ipynb)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### `highlight_language`\n",
"\n",
"Default language for syntax highlighting in reST and Markdown cells,\n",
"when no language is specified explicitly.\n",
"\n",
"By default, this is `'python3'`,\n",
"while Jupyter doesn't have a default language.\n",
"Set\n",
"[highlight_language](http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-highlight_language)\n",
"to `'none'` to get the same behavior as in Jupyter:\n",
"\n",
"```python\n",
"highlight_language = 'none'\n",
"```\n",
"\n",
"See also [nbsphinx_codecell_lexer](#nbsphinx_codecell_lexer)."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -273,11 +251,7 @@
"\n",
"Default Pygments lexer for syntax highlighting in code cells.\n",
"If available,\n",
"this information is taken from the notebook metadata instead.\n",
"\n",
"Please note that this is not the same as\n",
"[highlight_language](#highlight_language),\n",
"which is used for formatting code in Markdown cells!"
"this information is taken from the notebook metadata instead."
]
},
{
Expand Down
1 change: 1 addition & 0 deletions src/nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,7 @@ def parse(self, inputstring, document):

if resources.get('nbsphinx_orphan', False):
rst.Parser.parse(self, ':orphan:', document)
rst.Parser.parse(self, '.. highlight:: none', document)
if env.config.nbsphinx_prolog:
prolog = exporter.environment.from_string(
env.config.nbsphinx_prolog).render(env=env)
Expand Down

0 comments on commit e2021ca

Please sign in to comment.