from fastcore.test import test_eq
Code Tips
Code Tips operate the same way as Code Notes however they show up as tooltips instead and use the tip
tag instead of the explain
. Note that it also uses multiline CodeNotes by default so you need a start and an end.
To use this make sure that you add in hint.css
and tips.css
to the _quarto.yml
under the css
section!
download_tooltip_css
download_tooltip_css ()
write_tooltip_directives
write_tooltip_directives (explanation:str, hint_directives:list=['rounded', 'medium', 'right'], filename:str=None)
Creates a tooltip in style of hint_directives
with content explanation
Type | Default | Details | |
---|---|---|---|
explanation | str | The tooltip text | |
hint_directives | list | [‘rounded’, ‘medium’, ‘right’] | A list of css directives to modify the tooltip |
filename | str | None | An optional filename to be rendered |
convert_explanation
convert_explanation (explanation_cell, source)
Takes an explanation and source code and linkes them together in a new cell
extract_code
extract_code (start_code, end_code, source, instance_num, end_instance_num=0)
Finds code between start and finish potentially with instances to check
parse_code
parse_code (code_cell, markdown_cell)
Parses directives to extract the code needed to be highlighted
TipExportProc
TipExportProc (nb)
A proc that checks and reorganizes cells for documentation for proper explainations
parse_notes
parse_notes ()
Exports notebooks to parsed notes for documentation. Should be called in the workflow, not yourself!
= NBProcessor("test.ipynb", [TipExportProc], rm_directives=False)
processor processor.process()
"result.ipynb") write_nb(processor.nb,
To use this, add nbdev-extensions.codetips:TipExportProc
to your settings.ini
and add the required css files to your _quarto.yml
Now it will automatically build your docs like notes!
return a+b