Skip to content

Commit

Permalink
Docs: 增加标记文本扩展语法
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Nov 4, 2024
1 parent a2f9f98 commit 4e0da16
Show file tree
Hide file tree
Showing 5 changed files with 107 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,55 @@ The rendered output looks like this:

==FixIt== is an awesome Hugo theme!

The extended marked text syntax supports **6** types of Marked Text.

> [!WARNING]
> {{< version 0.3.14 >}}\
> This is experimental syntax highlighting for the marked texts.
```markdown
==Primary==[primary]
==Secondary==[secondary]
==Success==[success]
==Info==[info]
==Warning==[warning]
==Danger==[danger]
```

The rendered output looks like this:

==Primary==[primary]
==Secondary==[secondary]
==Success==[success]
==Info==[info]
==Warning==[warning]
==Danger==[danger]

Unless you customize marked text, any unsupported type defaults to the `default` type.

```markdown
==This is a custom type with pink color.==[pink]
```

Customize the marked text by adding the following CSS in your project directory `assets/css/_custom.scss`:

```scss {title="_custom.scss"}
.mark-pink {
--fi-mark-background-color: pink;
}
```

The rendered output looks like this:

==This is a custom type with pink color.==[pink]
{style="--fi-mark-background-color: pink;"}

The HTML looks like this:

```html
<mark class="mark-pink">This is a custom type with pink color.</mark>
```

## Subscript {#subscript}

**Hugo** supports a **subscript** Markdown extension:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,6 @@ Alert 扩展语法支持 **13** 种类型的 [警示横幅][admonition-types],

{{< version 0.3.14 changed >}}

To create a task list, start each list item with a hyphen and space followed by `[ ]`.

要创建任务列表,请在每个列表项前添加一个短横线和空格,然后跟上 `[ ]`

```markdown
Expand Down Expand Up @@ -209,6 +207,55 @@ FixIt 主题的作者是 ++Lruihao++。

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

扩展的标记文本语法支持**6**种类型的标记文本。

> [!WARNING]
> {{< version 0.3.14 >}}\
> 这是标记文本的实验性语法高亮。
```markdown
==Primary==[primary]
==Secondary==[secondary]
==Success==[success]
==Info==[info]
==Warning==[warning]
==Danger==[danger]
```

呈现的输出效果如下:

==Primary==[primary]
==Secondary==[secondary]
==Success==[success]
==Info==[info]
==Warning==[warning]
==Danger==[danger]

除非你自定义标记文本,否则任何不支持的类型都会默认为 `default` 类型。

```markdown
==这是一个带有粉色的自定义类型。==[pink]
```

在你的项目目录 `assets/css/_custom.scss` 中添加以下 CSS 来自定义标记文本:

```scss {title="_custom.scss"}
.mark-pink {
--fi-mark-background-color: pink;
}
```

呈现的输出效果如下:

==这是一个带有粉色的自定义类型。==[pink]
{style="--fi-mark-background-color: pink;"}

输出的 HTML 看起来像这样:

```html
<mark class="mark-pink">这是一个带有粉色的自定义类型。</mark>
```

## 下标 {#subscript}

**Hugo** 支持一种 **下标** Markdown 扩展语法:
Expand Down
6 changes: 6 additions & 0 deletions content/zh-cn/tests/markdown/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ menu:
> [!ban]+ ban admonition
> Lorem ipsum dolor sit amet consectetur adipisicing
## Marked Text

臣亮言:==先帝==[secondary]創業未半,而==中道崩殂==[info]。今天下三分,益州疲敝,此誠==危急存亡之秋==[danger]也!然侍衞之臣,不懈於內;==忠志之士==[primary],忘身於外者,蓋追先帝之殊遇,欲報之於陛下也。誠宜開張聖聽,以光先帝遺德,恢弘志士之氣;不宜妄自菲薄,引喻失義,以塞忠諫之路也。

宮中、府中,俱為一體;陟罰臧否,不宜異同。若有==作奸==[warning]、==犯科==[success],及為忠善者,宜付有司,論其刑賞,以昭陛下平明之治;不宜偏私,使內外異法也。

## 二级标题

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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/hugo-fixit/docs
go 1.20

require (
github.com/hugo-fixit/FixIt v0.3.14-0.20241102162829-41014f7f5bf1 // indirect
github.com/hugo-fixit/FixIt v0.3.14-0.20241104045219-712cf2a86806 // indirect
github.com/hugo-fixit/component-projects v1.4.0 // indirect
github.com/hugo-fixit/shortcode-caniuse v1.1.3 // indirect
github.com/hugo-fixit/shortcode-rewards v1.0.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
github.com/hugo-fixit/FixIt v0.3.14-0.20241102162829-41014f7f5bf1 h1:3+oeWV0Potv/RoUl59m3bfH1Cm93WA2KoVxEt1Ui4m8=
github.com/hugo-fixit/FixIt v0.3.14-0.20241102162829-41014f7f5bf1/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/FixIt v0.3.14-0.20241104045219-712cf2a86806 h1:eEbYgbwPb2l13R3j2damsikBegDa7zTdnFro1SNLo+8=
github.com/hugo-fixit/FixIt v0.3.14-0.20241104045219-712cf2a86806/go.mod h1:3XIRedrqakO7/a4ZnhE46haMRF8HgsT0N0B5j5D2iRU=
github.com/hugo-fixit/component-projects v1.4.0 h1:Z9q+aY/ZBD4qcqcnPWNlGc/c7HDYu+5hj996TCTpRw0=
github.com/hugo-fixit/component-projects v1.4.0/go.mod h1:nXW0R37REwpfwUD1I4RtB5QW71vw66nRyB9uEpYxr+c=
github.com/hugo-fixit/shortcode-caniuse v1.1.3 h1:U1YBJz5SI/d1BBQhHcD0eVgJdCcpzK2usSizPiu+a4w=
Expand Down

0 comments on commit 4e0da16

Please sign in to comment.