Reputation: 97
I want to change the font type in Markdown cells when I am editing them. How Can I do that?
I can edit the file .jupyter/custom/custom.css
and change the font when they are "run":
div.text_cell_render {
font-family: 'Linux Libertine O';
font-size: 12pt;
}
As shown in the figure, the upper half is a Markdown cell in edit mode, and that is the place where I want to change the font.
Upvotes: 1
Views: 6472
Reputation: 25023
A simple possibility is
from IPython.display import HTML, display
display(HTML('<style>.CodeMirror{font-family:whatever}</style>')
but beware that the code above changes also the fonts used for
Also note, that my simple proposal works on a notebook by notebook base, you have to add the lines to every notebook you want to modify. On the contrary, if you have a custom.css
file where it can be accessed by jupiter
during startup you can add the font-family:whatever
to it, to make the customization hold for every notebook that you are using.
For an example of permanent customization please have a look at this question from Joel Ostblom — in a nutshell, edit ~/.jupyter/custom/custom.css
and put in it
.CodeMirror pre {
font-family: "Ubuntu Mono", monospace;
font-size: 14pt;
...
}
Upvotes: 2