我想使用Markdown存储文本信息。但快速搜索显示Markdown不支持颜色。堆栈溢出也不支持颜色。与GitHub markdown的情况相同。

是否有允许彩色文本的markdown风格?


当前回答

屁股疼。

通过pandoc标记为PDF仅在使用时对我有效:

---
header-includes: 
                 \usepackage{xcolor}
                 \definecolor{alizarin}{rgb}{0.82, 0.1, 0.26}
---

\color{alizarin}The overarching aim \color{black} of this project is

“首要目标”用红色表示,其余用黑色表示。字体保持不变,没有空格问题。

导出到odt或docx-没有运气。

其他回答

这适用于记录笔记的乔普林:

<span style="color:red">text in red</span>

我喜欢重新定义现有标记的想法,如果它们未被使用,因为文本更干净,而牺牲了现有标记。内联样式有效,但在读取原始文本时会产生大量噪音。

使用VSCode,我发现顶部有一个小的<style>部分支持的自定义单字母标签在最小噪声的情况下工作得很好,特别是对于专色,例如。

<style>
r { color: Red }
o { color: Orange }
g { color: Green }
</style>

# TODOs:

- <r>TODO:</r> Important thing to do
- <o>TODO:</o> Less important thing to do
- <g>DONE:</g> Breath deeply and improve karma

我的用例是在开发过程中组织应用程序内的笔记,但我想它可能在其他地方奏效?

虽然Markdown不支持颜色,但如果你不需要太多,你总是可以牺牲一些支持的样式,使用CSS重新定义相关的标记,使其变为颜色,并删除格式,或者不删除。

例子:

// resets
s { text-decoration:none; } //strike-through
em { font-style: normal; font-weight: bold; } //italic emphasis


// colors
s { color: green }
em { color: blue }

另请参阅:如何将em标记重新设置为粗体而不是斜体

然后在标记文本中

~~This is green~~
_this is blue_

这应该更短:

<font color='red'>test blue color font</font>

在Jupyter笔记本中添加任何给定颜色的Hading。

将显示为笔记本中的标题,如果开头不使用##,将显示为给定颜色的普通文本