[英]Different font settings for editing code and markdown cells in the Jupyter Notebook
在 Jupyter notebook 中,我想在编辑Markdown 单元格时使用常规的 Ubuntu 字体,而在编辑代码单元格时使用 UbuntuMono。 我可以.jupyter/custom/custom.css
像这样编辑.jupyter/custom/custom.css
同时更改这两种单元格类型的字体:
.CodeMirror pre {
font-family: "Ubuntu Mono", monospace;
font-size: 14pt;
}
我还可以更改 Markdown 代码单元格中标题的格式:
.cm-header {
font-size: 110%;
font-family: "Ubuntu";
}
以及呈现时文本的外观(在执行降价单元后):
div.text_cell_render {
font-family: "Ubuntu";
font-size: 12pt;
}
但是,我不明白我可以使用哪些 css 类来区分编辑模式下 Markdown 单元格中的代码单元格和段落/正文文本。 我在 Firefox 中尝试了对象检查器,但两种单元格类型的输入文本显示为相同的跨度标签和 css 类。 我已经尝试了这里列出的许多组合,但似乎我找不到合适的组合,有什么想法吗?
我收到了来自 Jupyter Notebook 问题的回复,链接在我的问题评论中。 可以组合 CSS 选择器,因此以下解决了我的问题:
.text_cell .CodeMirror pre {
font-family: "Ubuntu";
font-size: 12pt;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.