Where is custom.css in the generated html file from nbconvert?
If your sole problem is this line: <link rel="stylesheet" href="custom.css">
, you can modify the template file and write a custom HTML exporter:
Navigate to the source directory of nbconvert. Go to ./templates/html/
. There will be a file called full.tpl
. This serves as the template for your HTML file. Open the file with a text editor and delete the <link rel="stylesheet" href="custom.css">
line.
Save the file with a .tpl
extension (fullcustom.tpl
). Make sure you save it in the same directory as full.tpl
.
The next step is to either write a custom exporter class in Python(recommended). You have to inherit the HTMLExporter
class defined in ./exporters/html.py
. You can follow the procedure described here: https://nbconvert.readthedocs.io/en/latest/external_exporters.html
Now, if you do not want to spend the time doing this, a quick "kludge" would be to actually modify the HTMLExporter
class. Create a copy of the html.py
file if you want as it is being modified. Open ./exporters/html.py
and find the following method in the HTMLExporter
class:
@default('template_file')
def _template_file_default(self):
return 'full.tpl'
Change return full.tpl
to the name you saved your modified version of full.tpl
with (fullcustom.tpl
).