diff options
| author | Eltrac <hi@guhub.cn> | 2025-07-17 10:21:51 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-07-17 10:21:51 +0800 |
| commit | 0e1ff20e27a5fc427c74717d16bebbe7d774479d (patch) | |
| tree | 8520e72118ee8a57b149813290ac29ba795800f7 | |
| parent | 605463f98caeb2ea7a82b207aa5389292b5d5323 (diff) | |
refactor: remove img shortcode and enable markdown attribuets
Former-commit-id: b01c58d9bb80f117d1181eb1d3b0b126ed0e7b44
| -rw-r--r-- | config/_default/markup.yaml | 5 | ||||
| -rw-r--r-- | content/posts/专家的直觉.md | 3 | ||||
| -rw-r--r-- | content/posts/明确讨论的范围.md | 3 | ||||
| -rw-r--r-- | content/posts/毫无敬意.md | 2 | ||||
| -rw-r--r-- | layouts/_markup/render-image.html | 22 | ||||
| -rw-r--r-- | layouts/_shortcodes/img.html | 25 |
6 files changed, 22 insertions, 38 deletions
diff --git a/config/_default/markup.yaml b/config/_default/markup.yaml index 12ea380b..05a43b15 100644 --- a/config/_default/markup.yaml +++ b/config/_default/markup.yaml @@ -1,6 +1,11 @@ goldmark: renderer: unsafe: true + parser: + attribute: + block: true + title: true + wrapStandAloneImageWithinParagraph: false extensions: extras: mark: diff --git a/content/posts/专家的直觉.md b/content/posts/专家的直觉.md index 8dbd6311..d9a3a6f7 100644 --- a/content/posts/专家的直觉.md +++ b/content/posts/专家的直觉.md @@ -41,7 +41,8 @@ draft: false 久而久之,你就可以抛弃你原来的系统,按照相似的思想和决策方式行事。即使没有直接屏蔽干扰,也没有明确的路径,你仍然能够通过直觉找到方向。 -{{< img src="https://image.guhub.cn/uPic/2025/01/IMG_0285.PNG" class="invert-if-dark" title="图片依次展示了「混沌」、「建立秩序」和「再入混沌」三个阶段" >}} + +{.invert-if-dark} 可以把先前践行的规则和使用的工具当作「引路人」的角色,当这条路走多了,即使引路人离开了你,你依然能在迷宫中找到正确的路径。 diff --git a/content/posts/明确讨论的范围.md b/content/posts/明确讨论的范围.md index 42399b3e..c1c3ac93 100644 --- a/content/posts/明确讨论的范围.md +++ b/content/posts/明确讨论的范围.md @@ -75,7 +75,8 @@ featured: true 允许了第二条「对目的本身的质疑和想法」存在,就允许讨论目的随着讨论的深入而发生改变。比如,人们已开始只是在讨论「怎么给自行车修棚」,当有人提出「为什么不给摩托车修棚?」并针对目的进行讨论之后,讨论的目的就可能变成「怎么给自行车和摩托车修棚」。这时候再严格地在范围内进行讨论,就不容易出错。 -{{< img src="https://image.guhub.cn/uPic/2025/03/scope-of-discussion.png" class="invert-if-dark" >}} + +{.invert-if-dark} ## 讨论中词句的目的 diff --git a/content/posts/毫无敬意.md b/content/posts/毫无敬意.md index 5a3fac41..4ddba1dd 100644 --- a/content/posts/毫无敬意.md +++ b/content/posts/毫无敬意.md @@ -22,7 +22,7 @@ toc: true ## 皇帝牌与父亲原型 -{{< img src="https://image.guhub.cn/uPic/2025/01/RWS_Tarot_04_Emperor.jpg" class="card" title="维特塔罗牌中的「皇帝」" >}} + 如果要我说出塔罗牌大阿卡纳里我最讨厌的一张牌,非「皇帝」莫属。皇帝牌在占星意义上对应的是「白羊座」,恰好也是我最讨厌的一个星座。[^1] diff --git a/layouts/_markup/render-image.html b/layouts/_markup/render-image.html index 21e574af..e2fbfd7f 100644 --- a/layouts/_markup/render-image.html +++ b/layouts/_markup/render-image.html @@ -1,16 +1,18 @@ {{- $src := .Destination -}} {{- $alt := .Text | default "" -}} {{- $caption := .Title | default "" -}} -<a href="{{ $src }}" data-fancybox data-caption="{{ $caption }}" class="fancybox-link"> - <figure> +{{- $class := .Attributes.class | default "" -}} + +<figure> + <a href="{{ $src }}" data-fancybox data-caption="{{ $caption }}" class="fancybox-link"> <img - class="lazy" loading="lazy" + class="lazy {{ $class }}" loading="lazy" src="{{ $src }}" alt="{{ $alt }}" /> - {{- if $caption }} - <figcaption> - <h4>{{ $caption | markdownify }}</h4> - </figcaption> - {{- end }} - </figure> -</a> + </a> + {{- if $caption }} + <figcaption> + <h4>{{ $caption | markdownify }}</h4> + </figcaption> + {{- end }} +</figure> diff --git a/layouts/_shortcodes/img.html b/layouts/_shortcodes/img.html deleted file mode 100644 index 01d0684b..00000000 --- a/layouts/_shortcodes/img.html +++ /dev/null @@ -1,25 +0,0 @@ -<!-- image --> -<figure {{ with .Get "class" }}class="{{ . }}"{{ end }}> -{{ with .Get "link" }}<a href="{{ . }}">{{ end }} - <a href="{{ .Get "src" }}" data-fancybox {{ if isset .Params "title" }} data-caption="{{.Get "title" }}" {{ end }}> - <img - class="lazy" - loading="lazy" - src="{{ .Get "src" }}" - {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" }}{{ end }}"{{ end }} - /> - </a> - {{ if .Get "link" }}</a>{{ end }} - {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }} - <figcaption>{{ if isset .Params "title" }} - <h4>{{ .Get "title" | markdownify }}</h4>{{ end }} - {{ if or (.Get "caption") (.Get "attr") }}<p> - {{ .Get "caption" }} - {{ with .Get "attrlink" }}<a href="{{ . }}"> {{ end }} - {{ .Get "attr" }} - {{ if .Get "attrlink" }}</a> {{ end }} - </p> {{ end }} - </figcaption> -{{ end }} -</figure> -<!-- image --> |
