我正在尝试在 Markdown 中使用彩色文本。在编辑器预览中,一切看起来都不错,但是当我将其推送到 GitLab 存储库时,文本没有着色。如何为文本着色?
In his beard lived three <span style="color:red">cardinals</span>.
Run Code Online (Sandbox Code Playgroud)
dej*_*dej 25
你可以试试这个,看来Gitlab渲染得不错,希望有帮助:
$`\textcolor{red}{\text{your text}}`$
$`\textcolor{blue}{\text{your text}}`$
$`\textcolor{green}{\text{your text}}`$
Run Code Online (Sandbox Code Playgroud)
还有diff
栅栏:
```diff
- RED text
+ GREEN text
! ORANGE text
# GRAY text
```
Run Code Online (Sandbox Code Playgroud)
mik*_*ike 15
不幸的是,大多数在 Markdown 中进行颜色处理的 HTML hack 都会被 GitLab 的表示层所抵消。
GitLab 的内联差异适用于 GitLab 在问题、Wiki 和 Markdown 预览中显示的 Markdown。
它支持[- red text -]
,[+ green text +]
但不支持其他。除了其预期目的之外,这对于在 Markdown 文档和注释中突出显示很有用,因为阴影是背景,而不是字母。
正如 @dejanualex 所回答的,您还可以使用内联 LaTeX(文档不会渲染 LaTeX,因此最好在GitLab 本身的文档代码中查看)。我在这里制作了一个示例片段:https ://gitlab.com/-/snippets/3606132
当 KaTeX 安装并启用后(位于 gitlab.com 上),它就可以工作。另请参阅/sf/answers/2945698381/。
因为它是LaTeX,所以它使用LaTeX字体。如果要匹配 GitLab 的 Markdown 字体,请使用\sf
或设置 LaTeX 字体\textsf
。请参阅https://katex.org/docs/supported.html#style-color-size-and-font
归档时间: |
|
查看次数: |
33821 次 |
最近记录: |