如何在iPython/Jupyter Notebook的Markdown单元中更改颜色? [英] How to change color in markdown cells ipython/jupyter notebook?

查看:446
本文介绍了如何在iPython/Jupyter Notebook的Markdown单元中更改颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想格式化一个单元格中的特定字符串.我将该单元格的格式更改为降价",但是我不确定如何更改单个单词的文本颜色.

I'm only looking to format a specific string within a cell. I change that cell's format to "Markdown" but I'm not sure how to change text color of a single word.

我不想更改整个笔记本的外观(通过CSS文件).

I don't want to change the look of the whole notebook (via a CSS file).

推荐答案

您可以简单地使用原始的html标签,例如

You can simply use raw html tags like

foo <font color='red'>bar</font> foo

请注意,将笔记本转换为乳胶将无法幸免.

Be aware that this will not survive a conversion of the notebook to latex.

由于有人反对建议的解决方案被弃用.它们是完全有效的,Scott已经用一种较新的方法(即基于CSS的方法)回答了这个问题. 但是,此答案显示了一些通用方法,这些方法可以在IPython中使用html标签来标记超出可用纯markdown功能的单元格内容.

As there are some complaints about the deprecation of the proposed solution. They are totally valid and Scott has already answered the question with a more recent, i.e. CSS based approach. Nevertheless, this answer shows some general approach to use html tags within IPython to style markdown cell content beyond the available pure markdown capabilities.

这篇关于如何在iPython/Jupyter Notebook的Markdown单元中更改颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆