From 0e1ff20e27a5fc427c74717d16bebbe7d774479d Mon Sep 17 00:00:00 2001 From: Eltrac Date: Thu, 17 Jul 2025 10:21:51 +0800 Subject: refactor: remove img shortcode and enable markdown attribuets Former-commit-id: b01c58d9bb80f117d1181eb1d3b0b126ed0e7b44 --- config/_default/markup.yaml | 5 +++++ ...256\266\347\232\204\347\233\264\350\247\211.md" | 3 ++- ...256\272\347\232\204\350\214\203\345\233\264.md" | 3 ++- ...257\253\346\227\240\346\225\254\346\204\217.md" | 2 +- layouts/_markup/render-image.html | 22 ++++++++++--------- layouts/_shortcodes/img.html | 25 ---------------------- 6 files changed, 22 insertions(+), 38 deletions(-) delete mode 100644 layouts/_shortcodes/img.html 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/\344\270\223\345\256\266\347\232\204\347\233\264\350\247\211.md" "b/content/posts/\344\270\223\345\256\266\347\232\204\347\233\264\350\247\211.md" index 8dbd6311..d9a3a6f7 100644 --- "a/content/posts/\344\270\223\345\256\266\347\232\204\347\233\264\350\247\211.md" +++ "b/content/posts/\344\270\223\345\256\266\347\232\204\347\233\264\350\247\211.md" @@ -41,7 +41,8 @@ draft: false 久而久之,你就可以抛弃你原来的系统,按照相似的思想和决策方式行事。即使没有直接屏蔽干扰,也没有明确的路径,你仍然能够通过直觉找到方向。 -{{< img src="https://image.guhub.cn/uPic/2025/01/IMG_0285.PNG" class="invert-if-dark" title="图片依次展示了「混沌」、「建立秩序」和「再入混沌」三个阶段" >}} +![](https://image.guhub.cn/uPic/2025/01/IMG_0285.PNG "图片依次展示了「混沌」、「建立秩序」和「再入混沌」三个阶段") +{.invert-if-dark} 可以把先前践行的规则和使用的工具当作「引路人」的角色,当这条路走多了,即使引路人离开了你,你依然能在迷宫中找到正确的路径。 diff --git "a/content/posts/\346\230\216\347\241\256\350\256\250\350\256\272\347\232\204\350\214\203\345\233\264.md" "b/content/posts/\346\230\216\347\241\256\350\256\250\350\256\272\347\232\204\350\214\203\345\233\264.md" index 42399b3e..c1c3ac93 100644 --- "a/content/posts/\346\230\216\347\241\256\350\256\250\350\256\272\347\232\204\350\214\203\345\233\264.md" +++ "b/content/posts/\346\230\216\347\241\256\350\256\250\350\256\272\347\232\204\350\214\203\345\233\264.md" @@ -75,7 +75,8 @@ featured: true 允许了第二条「对目的本身的质疑和想法」存在,就允许讨论目的随着讨论的深入而发生改变。比如,人们已开始只是在讨论「怎么给自行车修棚」,当有人提出「为什么不给摩托车修棚?」并针对目的进行讨论之后,讨论的目的就可能变成「怎么给自行车和摩托车修棚」。这时候再严格地在范围内进行讨论,就不容易出错。 -{{< img src="https://image.guhub.cn/uPic/2025/03/scope-of-discussion.png" class="invert-if-dark" >}} +![](https://image.guhub.cn/uPic/2025/03/scope-of-discussion.png) +{.invert-if-dark} ## 讨论中词句的目的 diff --git "a/content/posts/\346\257\253\346\227\240\346\225\254\346\204\217.md" "b/content/posts/\346\257\253\346\227\240\346\225\254\346\204\217.md" index 5a3fac41..4ddba1dd 100644 --- "a/content/posts/\346\257\253\346\227\240\346\225\254\346\204\217.md" +++ "b/content/posts/\346\257\253\346\227\240\346\225\254\346\204\217.md" @@ -22,7 +22,7 @@ toc: true ## 皇帝牌与父亲原型 -{{< img src="https://image.guhub.cn/uPic/2025/01/RWS_Tarot_04_Emperor.jpg" class="card" title="维特塔罗牌中的「皇帝」" >}} +![](https://image.guhub.cn/uPic/2025/01/RWS_Tarot_04_Emperor.jpg!small "维特塔罗牌中的「皇帝」") 如果要我说出塔罗牌大阿卡纳里我最讨厌的一张牌,非「皇帝」莫属。皇帝牌在占星意义上对应的是「白羊座」,恰好也是我最讨厌的一个星座。[^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 "" -}} - -
+{{- $class := .Attributes.class | default "" -}} + +
+ {{ $alt }} - {{- if $caption }} -
-

{{ $caption | markdownify }}

-
- {{- end }} -
- + + {{- if $caption }} +
+

{{ $caption | markdownify }}

+
+ {{- end }} +
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 @@ - -
-{{ with .Get "link" }}{{ end }} - - - - {{ if .Get "link" }}{{ end }} - {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr") }} -
{{ if isset .Params "title" }} -

{{ .Get "title" | markdownify }}

{{ end }} - {{ if or (.Get "caption") (.Get "attr") }}

- {{ .Get "caption" }} - {{ with .Get "attrlink" }} {{ end }} - {{ .Get "attr" }} - {{ if .Get "attrlink" }} {{ end }} -

{{ end }} -
-{{ end }} -
- -- cgit v1.2.3