Skip to content

使用Markdown书写文章时, 如何使用自定义的CSS样式 #448

Answered by Lruihao
762610973 asked this question in Q&A
Discussion options

You must be logged in to vote

有两种方式:

  1. 直接写 HTML,需要设置 goldmark.renderer.unsafetrue, 不然 HTML 不会被渲染。

    <span style="color: red">span tag color test</span>
  2. 使用自定义属性,Hugo 支持向 Markdown 块添加属性(例如 CSS 类),例如 表格、列表、段落等,需要设置 goldmark.parser.attribute.blocktrue。更多详情请看文档

    span tag color test
    {.text-danger}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@762610973
Comment options

Answer selected by Lruihao
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants