From e355715a3b5cd7fbfa01fb2df80125ddf381592c Mon Sep 17 00:00:00 2001 From: ZhenShuo Leo <98386542+ZhenShuo2021@users.noreply.github.com> Date: Sun, 7 Sep 2025 08:46:39 +0800 Subject: [PATCH] feat(timeline): support markdown content --- exampleSite/content/docs/shortcodes/index.it.md | 1 + exampleSite/content/docs/shortcodes/index.ja.md | 1 + exampleSite/content/docs/shortcodes/index.md | 3 ++- exampleSite/content/docs/shortcodes/index.zh-cn.md | 13 +++++++------ layouts/shortcodes/timelineItem.html | 7 ++++++- 5 files changed, 17 insertions(+), 8 deletions(-) diff --git a/exampleSite/content/docs/shortcodes/index.it.md b/exampleSite/content/docs/shortcodes/index.it.md index dbb72292..36d03194 100644 --- a/exampleSite/content/docs/shortcodes/index.it.md +++ b/exampleSite/content/docs/shortcodes/index.it.md @@ -720,6 +720,7 @@ The `timeline` creates a visual timeline that can be used in different use-cases | Parameter | Description | | ----------- | -------------------------------------------- | +| `md` | render the content as Markdown (true/false) | | `icon` | the icon to be used in the timeline visuals. | | `header` | header for each entry | | `badge` | text to place within the top right badge | diff --git a/exampleSite/content/docs/shortcodes/index.ja.md b/exampleSite/content/docs/shortcodes/index.ja.md index 56d129c7..fe640ae4 100644 --- a/exampleSite/content/docs/shortcodes/index.ja.md +++ b/exampleSite/content/docs/shortcodes/index.ja.md @@ -717,6 +717,7 @@ B-->C[利益] | パラメータ | 説明 | | ----------- | -------------------------------------------- | +| `md` | コンテンツを Markdown としてレンダリングする (true/false) | | `icon` | タイムラインのビジュアルで使用するアイコン | | `header` | 各エントリのヘッダーー | | `badge` | 右上のバッジ内に配置するテキスト | diff --git a/exampleSite/content/docs/shortcodes/index.md b/exampleSite/content/docs/shortcodes/index.md index 5e929d34..3d314462 100644 --- a/exampleSite/content/docs/shortcodes/index.md +++ b/exampleSite/content/docs/shortcodes/index.md @@ -728,7 +728,8 @@ The `timeline` creates a visual timeline that can be used in different use-cases | Parameter | Description | | ----------- | -------------------------------------------- | -| `icon` | the icon to be used in the timeline visuals. | +| `md` | render the content as Markdown (true/false) | +| `icon` | the icon to be used in the timeline visuals | | `header` | header for each entry | | `badge` | text to place within the top right badge | | `subheader` | entry's subheader | diff --git a/exampleSite/content/docs/shortcodes/index.zh-cn.md b/exampleSite/content/docs/shortcodes/index.zh-cn.md index 04a92b09..63e9537c 100644 --- a/exampleSite/content/docs/shortcodes/index.zh-cn.md +++ b/exampleSite/content/docs/shortcodes/index.zh-cn.md @@ -728,12 +728,13 @@ B-->C[Profit] `timeline` 创建了一个可视化时间线,用于展示专业经验、项目成就等。 `timeline` 简码依赖于 `timelineItem` 子简码来定义主时间线中的每个项目。每个项目可以具有以下属性。 -| 参数 | 功能 | -| ----------- | ------------------------ | -| `icon` | 要在时间线中使用的图标。 | -| `header` | 每个条目的标题 | -| `badge` | 放置在右上角徽章内的文本 | -| `subheader` | 每个条目的副标题 | +| 参数 | 功能 | +| ----------- | ----------------------------------- | +| `md` | 将内容渲染为 Markdown (true/false) | +| `icon` | 要在时间线中使用的图标 | +| `header` | 每个条目的标题 | +| `badge` | 放置在右上角徽章内的文本 | +| `subheader` | 每个条目的副标题 | diff --git a/layouts/shortcodes/timelineItem.html b/layouts/shortcodes/timelineItem.html index df9c9632..4302833d 100644 --- a/layouts/shortcodes/timelineItem.html +++ b/layouts/shortcodes/timelineItem.html @@ -1,4 +1,5 @@ {{ $icon := .Get "icon" | default "check" }} +{{ $md := .Get "md" | default false }} {{ $header := .Get "header" }} {{ $badge := .Get "badge" }} {{ $subheader := .Get "subheader" }} @@ -25,7 +26,11 @@ {{ end }}
- {{- .Inner -}} + {{ if $md }} + {{- .Inner | markdownify -}} + {{ else }} + {{- .Inner -}} + {{ end }}