From 299e966b41a58692b56ceb8dfbc47319fb00a003 Mon Sep 17 00:00:00 2001 From: wuxh Date: Mon, 1 Apr 2024 11:02:31 +0800 Subject: [PATCH 1/6] chore(link): fix line break --- src/loaders/markdown/transformer/rehypeDemo.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/loaders/markdown/transformer/rehypeDemo.ts b/src/loaders/markdown/transformer/rehypeDemo.ts index 9bbfec2ec..1fc6eafc8 100644 --- a/src/loaders/markdown/transformer/rehypeDemo.ts +++ b/src/loaders/markdown/transformer/rehypeDemo.ts @@ -319,11 +319,8 @@ export default function rehypeDemo( ) { const startLine = node.position?.start.line; const suffix = startLine ? `:${startLine}` : ''; - - logger.warn( - `Duplicate demo id found due to filename conflicts, please consider adding a unique id to code tag to resolve this. - at ${opts.fileAbsPath}${suffix}`, - ); + // prettier-ignore + logger.warn(`Duplicate demo id found due to filename conflicts, please consider adding a unique id to code tag to resolve this. at ${opts.fileAbsPath}${suffix}`); } // eslint-disable-next-line @typescript-eslint/no-unused-vars From 6c243fb3fe110a531953bb35e3ae15f9440e580d Mon Sep 17 00:00:00 2001 From: wuxh Date: Mon, 1 Apr 2024 11:16:08 +0800 Subject: [PATCH 2/6] docs: update demo.cols --- docs/guide/page-config.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/guide/page-config.md b/docs/guide/page-config.md index 1c0877d5c..409e8d61d 100644 --- a/docs/guide/page-config.md +++ b/docs/guide/page-config.md @@ -74,16 +74,28 @@ demo: ``` -配置 `demo.cols` 后,以下多个 demo 完将会被渲染为双栏布局: +配置 `demo.cols` 后,以下**连续多个**标签组成的 demo 完将会被渲染为双栏布局: ```md + + 分栏 1 分栏 2 分栏 3 分栏 4 + + + +bad 分栏 1 + +bad 分栏 2 ``` 分栏 1 分栏 2 分栏 3 分栏 4 + +bad 分栏 1 + +bad 分栏 2 From 231ddd62cb6de8aca27d4671414c02619cd93cd6 Mon Sep 17 00:00:00 2001 From: wuxh Date: Mon, 1 Apr 2024 11:42:05 +0800 Subject: [PATCH 3/6] test: update unit test --- .../transformer/fixtures/demo/cols/demo.jsx | 1 + .../transformer/fixtures/demo/cols/expect.ts | 61 +++++++++++++++++++ .../transformer/fixtures/demo/cols/index.md | 17 ++++++ 3 files changed, 79 insertions(+) create mode 100644 src/loaders/markdown/transformer/fixtures/demo/cols/demo.jsx create mode 100644 src/loaders/markdown/transformer/fixtures/demo/cols/expect.ts create mode 100644 src/loaders/markdown/transformer/fixtures/demo/cols/index.md diff --git a/src/loaders/markdown/transformer/fixtures/demo/cols/demo.jsx b/src/loaders/markdown/transformer/fixtures/demo/cols/demo.jsx new file mode 100644 index 000000000..c73b7bc3a --- /dev/null +++ b/src/loaders/markdown/transformer/fixtures/demo/cols/demo.jsx @@ -0,0 +1 @@ +export default () => 'demo'; diff --git a/src/loaders/markdown/transformer/fixtures/demo/cols/expect.ts b/src/loaders/markdown/transformer/fixtures/demo/cols/expect.ts new file mode 100644 index 000000000..fbeccb631 --- /dev/null +++ b/src/loaders/markdown/transformer/fixtures/demo/cols/expect.ts @@ -0,0 +1,61 @@ +import type { IMdTransformerResult } from '../../..'; + +export default (ret: IMdTransformerResult) => { + expect(ret.content).toMatchInlineSnapshot(` + "<>" + `); +}; diff --git a/src/loaders/markdown/transformer/fixtures/demo/cols/index.md b/src/loaders/markdown/transformer/fixtures/demo/cols/index.md new file mode 100644 index 000000000..866d92025 --- /dev/null +++ b/src/loaders/markdown/transformer/fixtures/demo/cols/index.md @@ -0,0 +1,17 @@ +--- +demo: + cols: 2 +--- + + + +分栏 1 +分栏 2 +分栏 3 +分栏 4 + + + +bad 分栏 1 + +bad 分栏 2 From 27a66baaa31180f25aa7ac429bbf1c90e7af6a23 Mon Sep 17 00:00:00 2001 From: wuxh Date: Mon, 1 Apr 2024 12:24:12 +0800 Subject: [PATCH 4/6] Revert "docs: update demo.cols" This reverts commit 6c243fb3fe110a531953bb35e3ae15f9440e580d. --- docs/guide/page-config.md | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/docs/guide/page-config.md b/docs/guide/page-config.md index 409e8d61d..1c0877d5c 100644 --- a/docs/guide/page-config.md +++ b/docs/guide/page-config.md @@ -74,28 +74,16 @@ demo: ``` -配置 `demo.cols` 后,以下**连续多个**标签组成的 demo 完将会被渲染为双栏布局: +配置 `demo.cols` 后,以下多个 demo 完将会被渲染为双栏布局: ```md - - 分栏 1 分栏 2 分栏 3 分栏 4 - - - -bad 分栏 1 - -bad 分栏 2 ``` 分栏 1 分栏 2 分栏 3 分栏 4 - -bad 分栏 1 - -bad 分栏 2 From 1d091ae6c2457bb401097306f5236953c077761b Mon Sep 17 00:00:00 2001 From: wuxh Date: Mon, 1 Apr 2024 12:26:15 +0800 Subject: [PATCH 5/6] chore: update doc --- docs/guide/page-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/page-config.md b/docs/guide/page-config.md index 1c0877d5c..4e22298f2 100644 --- a/docs/guide/page-config.md +++ b/docs/guide/page-config.md @@ -74,7 +74,7 @@ demo: ``` -配置 `demo.cols` 后,以下多个 demo 完将会被渲染为双栏布局: +配置 `demo.cols` 后,以下仅用换行符分隔的 code 标签 demo 会被渲染为双栏布局: ```md 分栏 1 From 4775118d32056263771c6a84ef4d0e03b5f07eae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=A2?= Date: Tue, 2 Apr 2024 21:35:30 +0800 Subject: [PATCH 6/6] Update docs/guide/page-config.md Co-authored-by: Peach --- docs/guide/page-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/page-config.md b/docs/guide/page-config.md index 4e22298f2..c7236804a 100644 --- a/docs/guide/page-config.md +++ b/docs/guide/page-config.md @@ -74,7 +74,7 @@ demo: ``` -配置 `demo.cols` 后,以下仅用换行符分隔的 code 标签 demo 会被渲染为双栏布局: +配置 `demo.cols` 后,以下用**单个换行符**分隔的 code 标签 demo 会被渲染为双栏布局: ```md 分栏 1