Hi,
after upgrading from nbconvert-5.6.1 to 6.0.1, most of the format rules defined in my ~/.jupyter/custom/custom.css are ignored when exporting to html.
Inspecting the html file generated by nbconvert, I find that the styles of my custom.css file are placed at the top of the file, instead of the bottom of the style section. Many styles are then overruled by styles put by nbconvert, defined I don’t know where.
This used to work correctly in 5.61, but the output is wrong in both 6.0.1 and 6.0.2.
Is there anything new in 6.x that I should take into account, or is this just a bug?
HTML templates were reworked significantly in 6.0. I’d make an issue on nbconvert and tag @SylvainCorlay on the issue as I think he’d know more about the intent of changes. Though being able to override hard-coded style changes without making your own full template seems like it should be made available for the provided html templates.
As of 6.0, the template system has been completely refactored. It is the main change that prescribed the major version bump.
The default template applied when exporting to HTML now produces the same DOM structure as JupyterLab, and is styled using JupyterLab’s CSS. The pygments theme in use mimics JupyterLab’s codemirror mode with the same CSS variables, so that custom JupyterLab themes could be applied. The classic notebook styling can still be enabled with
jupyter nbconvert --to html --template classic
However, we do not allow for the custom.css anymore.
Nbconvert 6.0 includes a new system for creating custom templates, which can now be installed as packages. A custom “foobar” template is installed in Jupyter’s data directory under nbconvert/templates and has the form of a directory containing all resources. Templates specify their base template as well as other configuration parameters in a conf.json at the root of the template directory. More information can be found at: https://nbconvert.readthedocs.io/en/latest/customizing.html
Hi, thank you for your prompt response.
I guess I’ll stick to 5.6 right now. I need some immediate results and the old way is already working for me.
Later on I might investigate the new method.