Skip to content

Commit

Permalink
Docs: 增加 GitHub Alerts 语法支持
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Aug 29, 2024
1 parent 901fc3b commit 6803ce4
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,48 @@ The rendered output looks like this:

==FixIt== is an awesome Hugo theme!

## Alerts {#alerts}

{{< version 0.3.10 >}}

Also known as callouts or admonitions, alerts are blockquotes used to emphasize critical information. An example of all five types:

```markdown {data-open=true}
> [!NOTE]
> Highlights information that users should take into account, even when skimming.

> [!TIP]
> Optional information to help a user be more successful.

> [!IMPORTANT]
> Crucial information necessary for users to succeed.

> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.

> [!CAUTION]
> Negative potential consequences of an action.
```

Here is how they are displayed:

> [!NOTE]
> Highlights information that users should take into account, even when skimming.
> [!TIP]
> Optional information to help a user be more successful.
> [!IMPORTANT]
> Crucial information necessary for users to succeed.
> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.
> [!CAUTION]
> Negative potential consequences of an action.
> This syntax is compatible with the [GitHub Alert][github-alert] Markdown extension.
## Subscript {#subscript}

**Hugo** supports a **subscript** Markdown extension:
Expand Down Expand Up @@ -376,11 +418,11 @@ The rendered output looks like this:

**[link{?]}(#escape-character)** instead of **[link](#escape-character)**.

## Custom attribute
## Markdown attributes

> Default off, need to set `goldmark.parser.attribute.block` to `true`.
> Update your site configuration to enable [Markdown attributes][markdown-attributes] for block-level elements.
Hugo supports adding attributes (e.g. CSS classes) to Markdown blocks, e.g. tables, lists, paragraphs etc.
Hugo supports Markdown attributes on images and block elements including blockquotes, fenced code blocks, headings, horizontal rules, lists, paragraphs, and tables.

### Syntax

Expand Down Expand Up @@ -423,16 +465,14 @@ The rendered output looks like this:
A blockquote with a CSS class:

```md
> foo\
> bar
{.text-danger}
> The quick brown fox jumps over the lazy dog.
{.blockquote-center}
```

The rendered output looks like this:

> foo\
> bar
{.text-danger}
> The quick brown fox jumps over the lazy dog.
{.blockquote-center}

#### table & list

Expand Down Expand Up @@ -545,13 +585,15 @@ This part is shown in the [diagrams support][diagrams-support-mermaid] page.
This part is shown in the [Timeline support][timeline-support] page.

<!-- link reference definition -->
[github-alert]: https://github.com/orgs/community/discussions/16925
[emoji-support]: {{< relref path="/guides/emoji-support" >}}
[katex]: https://katex.org/
[theme-config]: {{< relref path="/documentation/getting-started/configuration#theme-configuration" >}}
[copy-tex]: https://github.com/Khan/KaTeX/tree/master/contrib/copy-tex
[mhchem]: https://github.com/Khan/KaTeX/tree/master/contrib/mhchem
[fontawesome]: https://fontawesome.com/
[fontawesome-icons]: https://fontawesome.com/icons?d=gallery
[markdown-attributes]: https://gohugo.io/content-management/markdown-attributes/
[code-fences]: https://gohugo.io/content-management/syntax-highlighting/#highlighting-in-code-fences
[diagrams-support-goat]: {{< relref path="/documentation/content-management/diagrams#goat" >}}
[diagrams-support-mermaid]: {{< relref path="/documentation/content-management/diagrams#mermaid" >}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,48 @@ FixIt 主题的作者是 ++Lruihao++。

==FixIt== 是一个很棒的 Hugo 主题!

## 警示 {#alerts}

{{< version 0.3.10 >}}

警示(Alerts)也被称为 **callouts****admonitions**,是用于强调关键信息的引用块。以下是所有五种类型的示例:

```markdown {data-open=true}
> [!NOTE]
> 突出显示用户应考虑的信息,即使只是浏览也应考虑。

> [!TIP]
> 可选信息,可帮助用户取得更大的成功。

> [!IMPORTANT]
> 用户成功所需的关键信息。

> [!WARNING]
> 由于存在潜在风险,需要用户立即关注的关键内容。

> [!CAUTION]
> 操作的潜在负面后果。
```

它们的显示方式如下:

> [!NOTE]
> 突出显示用户应考虑的信息,即使只是浏览也应考虑。
> [!TIP]
> 可选信息,可帮助用户取得更大的成功。
> [!IMPORTANT]
> 用户成功所需的关键信息。
> [!WARNING]
> 由于存在潜在风险,需要用户立即关注的关键内容。
> [!CAUTION]
> 操作的潜在负面后果。
> 这种语法与 [GitHub Alert][github-alert] Markdown 扩展语法兼容。
## 下标 {#subscript}

**Hugo** 支持一种 **下标** Markdown 扩展语法:
Expand Down Expand Up @@ -376,11 +418,11 @@ $$ \ce{Hg\^2+ ->[I-] HgI2 ->[I-] [Hg\^{II}I4]\^2-} $$

**[link{?]}(#escape-character)** 而不是 **[link](#escape-character)**

## 自定义属性
## Markdown 属性

> 默认关闭,需设置 `goldmark.parser.attribute.block``true`
> 更新你的站点配置以启用块级元素的 [Markdown 属性][markdown-attributes]
Hugo 支持向 Markdown 块添加属性(例如 CSS 类),例如 表格、列表、段落等
Hugo 支持图像和块元素上的 Markdown 属性,包括块引用、围栏代码块、标题、水平线、列表、段落和表格

### 语法

Expand Down Expand Up @@ -423,16 +465,14 @@ some Markdown content
带有 CSS 类的块引用:

```md
> foo\
> bar
{#test-id .text-danger}
> The quick brown fox jumps over the lazy dog.
{.blockquote-center}
```

呈现的输出如下所示:

> foo\
> bar
{#test-id .text-danger}
> The quick brown fox jumps over the lazy dog.
{.blockquote-center}

#### 表格 & 列表

Expand Down Expand Up @@ -545,13 +585,15 @@ console.log('hello FixIt!');
这部分内容在 [时间线支持][timeline-support] 页面中介绍。

<!-- link reference definition -->
[github-alert]: https://github.com/orgs/community/discussions/16925
[emoji-support]: {{< relref path="/guides/emoji-support" >}}
[katex]: https://katex.org/
[theme-config]: {{< relref path="/documentation/getting-started/configuration#theme-configuration" >}}
[copy-tex]: https://github.com/Khan/KaTeX/tree/master/contrib/copy-tex
[mhchem]: https://github.com/Khan/KaTeX/tree/master/contrib/mhchem
[fontawesome]: https://fontawesome.com/
[fontawesome-icons]: https://fontawesome.com/icons?d=gallery
[markdown-attributes]: https://gohugo.io/content-management/markdown-attributes/
[code-fences]: https://gohugo.io/content-management/syntax-highlighting/#highlighting-in-code-fences
[diagrams-support-goat]: {{< relref path="/documentation/content-management/diagrams#goat" >}}
[diagrams-support-mermaid]: {{< relref path="/documentation/content-management/diagrams#mermaid" >}}
Expand Down
22 changes: 22 additions & 0 deletions content/zh-cn/tests/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,28 @@ menu:
---
<!-- markdownlint-disable-file MD045 -->

## Alerts

哈哈哈哈哈哈 nformation that users should take into accou

> [!NOTE]
> Highlights information that users should take into account, even when skimming.
> [!TIP]
> Optional information to help a user be more successful.
> [!IMPORTANT]
> Crucial information necessary for users to succeed.
> [!WARNING]
> Critical content demanding immediate user attention due to potential risks.
> [!CAUTION]
> Negative potential consequences of an action.
> 哈哈哈哈哈哈哈哈
{.blockquote-center}

## 二级标题

Lorem ipsum dolor sit amet consectetur adipisicing elit. Maxime deleniti natus sint velit ut, dolorem optio vero odio repellat aliquam, at repellendus fuga nemo porro adipisci doloremque, amet inventore molestias.
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/hugo-fixit/docs
go 1.20

require (
github.com/hugo-fixit/FixIt v0.3.10-0.20240824093031-3ffef8acb0d0 // indirect
github.com/hugo-fixit/component-projects v1.1.2 // indirect
github.com/hugo-fixit/FixIt v0.3.10-0.20240829143006-5dac03a90dca // indirect
github.com/hugo-fixit/component-projects v1.1.3 // indirect
github.com/hugo-fixit/shortcode-caniuse v1.1.3 // indirect
github.com/hugo-fixit/shortcode-rewards v1.0.4 // indirect
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/hugo-fixit/FixIt v0.3.10-0.20240824093031-3ffef8acb0d0 h1:hovn8ouFgXMO0YF49qwIx6yrHCxPxtbsYP2sc2Z1/sc=
github.com/hugo-fixit/FixIt v0.3.10-0.20240824093031-3ffef8acb0d0/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.1.2 h1:hKJ+1CM6Y0wEdA8Pnn8MSZel+ukYtUvzC3VQk+AFSl4=
github.com/hugo-fixit/component-projects v1.1.2/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=
github.com/hugo-fixit/FixIt v0.3.10-0.20240829143006-5dac03a90dca h1:JcrB1boLI+7e1XSQd3ahNWDsnGDrHs9DT1z56v5dC8I=
github.com/hugo-fixit/FixIt v0.3.10-0.20240829143006-5dac03a90dca/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.1.3 h1:iK6q07CpFsnnJGh8q2stVjv6Lr77dTM9o+P7LGDEYmE=
github.com/hugo-fixit/component-projects v1.1.3/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=
github.com/hugo-fixit/shortcode-caniuse v1.1.3 h1:U1YBJz5SI/d1BBQhHcD0eVgJdCcpzK2usSizPiu+a4w=
github.com/hugo-fixit/shortcode-caniuse v1.1.3/go.mod h1:RoPLFt+7uLui5rjvkC/qFGeo4nly5AzzwIID9SoDKNc=
github.com/hugo-fixit/shortcode-rewards v1.0.4 h1:62qCmcGvAJf+qa+8ofRX6jwMUXo6Q4+PQvlOtu0ZGBA=
Expand Down

0 comments on commit 6803ce4

Please sign in to comment.