我的hugo-theme-stack

背景

我以前用Hexo下的NexT主题,它很华丽,但打开图片多的文章时巨卡无比比如这篇

这次我选择了hugo-theme-stack,主要是看中了gallery功能。

更改

大更改

为了方便改主题,我使用了git-submodule安装方式,然后把starter里的config文件夹复制到自己的站点文件夹里。

mermaid

我按照hugo doc里的方法加了mermaid支持。

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts 
prevail! John-->>Alice: Great! John->>Bob: How about you? Bob-->>John: Jolly good!
graph TD
          A[Christmas] -->|Get money| B(Go shopping)
          B --> C{Let me think}
          B --> G[/Another/]
          C ==>|One| D[Laptop]
          C -->|Two| E[iPhone]
          C -->|Three| F[fa:fa-car Car]
          subgraph section
            C
            D
            E
            F
            G
          end
  

admonition(alert)

加了admonition,也叫alert。实现方式基于DoIt里的admonition。样式与github alert 接近。

现支持以下种类

github alert:

Note

Useful information that users should know, even when skimming content.

Tip

Helpful advice for doing things better or more easily.

Important

Key information users need to know to achieve their goal.

Warning

Urgent info that needs immediate user attention to avoid problems.

Caution

Advises about risks or negative outcomes of certain actions.

部分mkdocs

Info

info

Question

question

Danger

danger

Bug

bug

github alert

无标题

> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

有标题(真正的github alert不支持)

> [!WARNING]+ Radiation hazard
> Do not approach or handle without protective gear.
Radiation hazard

Do not approach or handle without protective gear.

hugo shortcode
{{< admonition  type=note title="This is a note" >}}
A **note** banner
{{< /admonition >}}

{{< admonition  type=tip title="This is a tip" >}}
A **tip** banner
{{< /admonition >}}

也可以不加type和title,默认type为note,title为type,效果如下:

{{< admonition >}}
Default
{{< /admonition >}}

{{< admonition tip >}}
default tip
{{< /admonition >}}
Note
Default
Tip
Default tip

小更改

小的更改被我放在了site文件夹下。

把链接改成了蓝色,改了代码的字体和字号。

问题

  • 暗色模式没法被dark reader识别。

  • mermaid的颜色没法随着亮色/暗色模式的切换而切换。(DoIt也有这个问题,于是我写了一个亮暗都能看清不过很丑的mermaid主题)

  • 目录没法自动折叠。

Licensed under CC BY-NC-SA 4.0
使用 Hugo 构建
主题 StackJimmy 设计