问题描述
我只想在单元格中格式化特定的字符串。我将该单元格的格式更改为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标签的一般方法,用于设置降价单元格内容的样式,超出可用的纯降价功能。
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笔记本中改变颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!