From 1677648167c7e7f47223da3fe89e649537a5ea41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=A1=E6=A2=A6=E6=98=9F=E5=B0=98?= Date: Sat, 6 Aug 2022 15:18:13 +0800 Subject: [PATCH] :lipstick: Add quote & note shortcodes. Close #29 --- exampleSite/content/post/shortcodes.md | 76 ++++++++++++++++++++++++++ layouts/shortcodes/note.html | 3 + layouts/shortcodes/quote.html | 3 + 3 files changed, 82 insertions(+) create mode 100644 exampleSite/content/post/shortcodes.md create mode 100644 layouts/shortcodes/note.html create mode 100644 layouts/shortcodes/quote.html diff --git a/exampleSite/content/post/shortcodes.md b/exampleSite/content/post/shortcodes.md new file mode 100644 index 0000000..b103e6b --- /dev/null +++ b/exampleSite/content/post/shortcodes.md @@ -0,0 +1,76 @@ +--- +title: "自定义短语示例" +description: "将常用的块引用、标签卡、按钮等信息设置成短代码,便于快速引用" +keywords: "shortcode,短代码" + +date: 2022-08-06T14:41:50+08:00 +lastmod: 2022-08-06T14:41:50+08:00 + +categories: + - 示例 +tags: + - 短代码 + - 语法 +url: "post/shortcodes.html" +--- + +虽然 `Markdown` 语法已经非常丰富能够满足我们写文章的绝大部分需求,但是为更好的对文章内容进行更友好的排版,为引设计一套自定义的短语,便于在使用时能够快速引用。 + + + +# 块引用 + +在引用一些经典名言名句时,可以采用此短语,语法参考如下: + +```markdown +{{}} + ### block quote + 写下你想表达的话语! +{{}} +``` + +实际效果: + +{{< quote >}} + +希望是无所谓有,无所谓无的,这正如地上的路。 + + +其实地上本没有路,走的人多了,也便成了路。 + +**鲁迅** + +{{< /quote >}} + +# 信息块 + +支持 `default`,`info`,`success`,`warning`,`danger` 等五种不同效果的信息块展示,语法参考如下: + +```markdown +{{}} + 书写表达的信息 + 支持 Markdown 语法 +{{}} +``` + +实际效果: + +{{< note info >}} + ### Info Header + **Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org) +{{< /note >}} + +{{< note success >}} + ### Success Header + **Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org) +{{< /note >}} + +{{< note warning >}} + ### Warning Header + **Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org) +{{< /note >}} + +{{< note danger >}} + ### Danger Header + **Welcome** to [Hugo NexT!](https://preview.hugo-next.eu.org) +{{< /note >}} diff --git a/layouts/shortcodes/note.html b/layouts/shortcodes/note.html new file mode 100644 index 0000000..6f15f99 --- /dev/null +++ b/layouts/shortcodes/note.html @@ -0,0 +1,3 @@ +
+ {{ .Inner | markdownify }} +
\ No newline at end of file diff --git a/layouts/shortcodes/quote.html b/layouts/shortcodes/quote.html new file mode 100644 index 0000000..eb02719 --- /dev/null +++ b/layouts/shortcodes/quote.html @@ -0,0 +1,3 @@ +
+ {{ .Inner | markdownify }} +
\ No newline at end of file