If you are not satisfied with the CSS styles
provided by nbsphinx
and by your Sphinx theme,
don't worry,
you can add your own styles easily.
Just create your own CSS file, e.g. my-own-style.css
,
and put it into the _static/
sub-directory
of your source directory.
You'll also have to set the config values
html_static_path
and
html_css_files
in your conf.py
, e.g. like this:
html_static_path = ['_static']
html_css_files = ['my-own-style.css']
If you want your style to only apply to *.rst
files
(and not Jupyter notebooks or other source files),
you can use
rst_prolog
with the
raw
directive in your conf.py
like this:
rst_prolog = """
.. raw:: html
<style>
h1 {
color: fuchsia;
}
</style>
"""
Similarly, if you want your style to only apply to notebooks, you can use nbsphinx_prolog like this:
nbsphinx_prolog = """
.. raw:: html
<style>
h1 {
color: chartreuse;
}
</style>
"""
For styles that should affect only the current notebook,
you can simply insert <style>
tags
into Markdown cells like this:
<style>
.nbinput .prompt,
.nboutput .prompt {
display: none;
}
</style>
This CSS example removes the input and output prompts from code cells, see the following cell:
6 * 7