-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
162 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Custom CSS\n", | ||
"\n", | ||
"If you are not satisfied with the CSS styles\n", | ||
"provided by `nbsphinx`\n", | ||
"and by your Sphinx theme,\n", | ||
"don't worry,\n", | ||
"you can add your own styles easily." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## For All Pages\n", | ||
"\n", | ||
"Just create your own CSS file, e.g. `my-own-style.css`,\n", | ||
"and put it into the `_static/` sub-directory\n", | ||
"of your source directory.\n", | ||
"\n", | ||
"You'll also have to set the config values\n", | ||
"[html_static_path](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_static_path)\n", | ||
"and\n", | ||
"[html_css_files](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_css_files)\n", | ||
"in your `conf.py`, e.g. like this:\n", | ||
"\n", | ||
"```python\n", | ||
"html_static_path = ['_static']\n", | ||
"html_css_files = ['my-own-style.css']\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## For All RST files\n", | ||
"\n", | ||
"If you want your style to only apply to `*.rst` files\n", | ||
"(and not Jupyter notebooks or other source files),\n", | ||
"you can use\n", | ||
"[rst_prolog](https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-rst_prolog)\n", | ||
"with the\n", | ||
"[raw](https://docutils.sourceforge.io/docs/ref/rst/directives.html#raw-data-pass-through)\n", | ||
"directive in your `conf.py` like this:\n", | ||
"\n", | ||
"```python\n", | ||
"rst_prolog = \"\"\"\n", | ||
".. raw:: html\n", | ||
"\n", | ||
" <style>\n", | ||
" h1 {\n", | ||
" color: fuchsia;\n", | ||
" }\n", | ||
" </style>\n", | ||
"\"\"\"\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## For All Notebooks\n", | ||
"\n", | ||
"Similarly,\n", | ||
"if you want your style to only apply to notebooks,\n", | ||
"you can use [nbsphinx_prolog](prolog-and-epilog.ipynb)\n", | ||
"like this:\n", | ||
"\n", | ||
"```python\n", | ||
"nbsphinx_prolog = \"\"\"\n", | ||
".. raw:: html\n", | ||
"\n", | ||
" <style>\n", | ||
" h1 {\n", | ||
" color: chartreuse;\n", | ||
" }\n", | ||
" </style>\n", | ||
"\"\"\"\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"## For a Single Notebook\n", | ||
"\n", | ||
"For styles that should affect only the current notebook,\n", | ||
"you can simply insert `<style>` tags\n", | ||
"into Markdown cells like this:\n", | ||
"\n", | ||
"```html\n", | ||
"<style>\n", | ||
" .nbinput .prompt,\n", | ||
" .nboutput .prompt {\n", | ||
" display: none;\n", | ||
" }\n", | ||
"</style> \n", | ||
"```\n", | ||
"\n", | ||
"<style>\n", | ||
" .nbinput .prompt,\n", | ||
" .nboutput .prompt {\n", | ||
" display: none;\n", | ||
" }\n", | ||
"</style>\n", | ||
"\n", | ||
"This CSS example removes the input and output prompts\n", | ||
"from code cells,\n", | ||
"see the following cell:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"6 * 7" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters