From 4352cde6fd0ae6e6051e83e426ec189f45abd5d8 Mon Sep 17 00:00:00 2001
From: Farnabaz
Date: Thu, 9 Apr 2026 11:08:00 +0200
Subject: [PATCH 1/5] fix(inline): allow writing markdown inside
`:inline[content]` syntax
---
src/syntax/block.ts | 6 ++----
src/syntax/inline-component.ts | 20 +++++++++++++++-----
test/fixtures.test.ts | 2 +-
test/input/17.markdonw-directive.md | 13 +++++++++++++
test/output/1.basic.html | 2 +-
test/output/10.blocks-yaml.html | 2 +-
test/output/11.blocks-list.html | 2 +-
test/output/12.frontmatter.html | 2 +-
test/output/13.vue-template.html | 2 +-
test/output/14.list-handling.html | 2 +-
test/output/15.blocks-codeblock.html | 2 +-
test/output/16.blocks-headings-in-slots.html | 2 +-
test/output/17.markdonw-directive.html | 9 +++++++++
test/output/2.blocks.html | 2 +-
test/output/3.blocks-slots.html | 2 +-
test/output/4.blocks-nesting.html | 2 +-
test/output/5.blocks-props.html | 2 +-
test/output/6.inline-props.html | 2 +-
test/output/7.inline-components.html | 2 +-
test/output/8.inline-span.html | 2 +-
test/output/9.blocks-slots.html | 2 +-
21 files changed, 56 insertions(+), 26 deletions(-)
create mode 100644 test/input/17.markdonw-directive.md
create mode 100644 test/output/17.markdonw-directive.html
diff --git a/src/syntax/block.ts b/src/syntax/block.ts
index 40f3de1..dafe891 100644
--- a/src/syntax/block.ts
+++ b/src/syntax/block.ts
@@ -47,10 +47,8 @@ export const MarkdownItMdcBlock: MarkdownIt.PluginSimple = (md) => {
// Create inline container for the content
const inline = state.push('inline', '', 0)
- inline.content = ''
- const text = new state.Token('text', '', 0)
- text.content = content
- inline.children = [text]
+ inline.content = content
+ inline.children = []
const tokenClose = state.push('mdc_block_shorthand', name, -1)
tokenClose.map = [startLine, startLine + 1]
diff --git a/src/syntax/inline-component.ts b/src/syntax/inline-component.ts
index c40b44f..a38c35a 100644
--- a/src/syntax/inline-component.ts
+++ b/src/syntax/inline-component.ts
@@ -23,7 +23,8 @@ export const MarkdownItInlineComponent: MarkdownIt.PluginWithOptions {
parser: 'html',
})
- await expect(formatted.trim())
+ await expect(formatted)
.toMatchFileSnapshot(path.replace('input', 'output').replace('.md', '.html'))
})
})
diff --git a/test/input/17.markdonw-directive.md b/test/input/17.markdonw-directive.md
new file mode 100644
index 0000000..d388e05
--- /dev/null
+++ b/test/input/17.markdonw-directive.md
@@ -0,0 +1,13 @@
+:spoiler[it's a _happy_ ending]
+
+:ref[see **figure 1**]{target=myFigure}
+
+Hello :spoiler[it's a _happy_ ending]
+
+::: note
+The label contains inline content but the body has block content.
+:::
+
+::: note{type="info"}
+The label contains inline content but the body has block content.
+:::
diff --git a/test/output/1.basic.html b/test/output/1.basic.html
index db6ad36..e223e83 100644
--- a/test/output/1.basic.html
+++ b/test/output/1.basic.html
@@ -48,4 +48,4 @@ Hello
.mdc-button {
background-color: #ff0000;
}
-
\ No newline at end of file
+
diff --git a/test/output/10.blocks-yaml.html b/test/output/10.blocks-yaml.html
index 9ae6a67..b31a4ee 100644
--- a/test/output/10.blocks-yaml.html
+++ b/test/output/10.blocks-yaml.html
@@ -10,4 +10,4 @@ Hello World
Hello World
-
\ No newline at end of file
+
diff --git a/test/output/11.blocks-list.html b/test/output/11.blocks-list.html
index ca86b00..3c36ebb 100644
--- a/test/output/11.blocks-list.html
+++ b/test/output/11.blocks-list.html
@@ -3,4 +3,4 @@
Hello
World
-
\ No newline at end of file
+
diff --git a/test/output/12.frontmatter.html b/test/output/12.frontmatter.html
index 46c27b9..763e355 100644
--- a/test/output/12.frontmatter.html
+++ b/test/output/12.frontmatter.html
@@ -1 +1 @@
-
\ No newline at end of file
+
diff --git a/test/output/13.vue-template.html b/test/output/13.vue-template.html
index c05744f..536eb5c 100644
--- a/test/output/13.vue-template.html
+++ b/test/output/13.vue-template.html
@@ -1,4 +1,4 @@
Foo {{ 1 + 1 }}
Hello {{ world }}
${foo} {{ bar }} {{ b ${a} }}
-{foo}
\ No newline at end of file
+{foo}
diff --git a/test/output/14.list-handling.html b/test/output/14.list-handling.html
index 4c88a83..0f7ad56 100644
--- a/test/output/14.list-handling.html
+++ b/test/output/14.list-handling.html
@@ -19,4 +19,4 @@
Foo
-
\ No newline at end of file
+
diff --git a/test/output/15.blocks-codeblock.html b/test/output/15.blocks-codeblock.html
index a95459b..c7d7f06 100644
--- a/test/output/15.blocks-codeblock.html
+++ b/test/output/15.blocks-codeblock.html
@@ -6,4 +6,4 @@ Title
This is a paragraph
-
\ No newline at end of file
+
diff --git a/test/output/16.blocks-headings-in-slots.html b/test/output/16.blocks-headings-in-slots.html
index bb7838b..d714239 100644
--- a/test/output/16.blocks-headings-in-slots.html
+++ b/test/output/16.blocks-headings-in-slots.html
@@ -3,4 +3,4 @@ Step 1
Content for step 1.
Step2
More content.
-
\ No newline at end of file
+
diff --git a/test/output/17.markdonw-directive.html b/test/output/17.markdonw-directive.html
new file mode 100644
index 0000000..fd321c0
--- /dev/null
+++ b/test/output/17.markdonw-directive.html
@@ -0,0 +1,9 @@
+it's a happy ending
+[see figure 1](myFigure)
+
+ Hello it's a happy ending
+
+The label contains inline content but the body has block content.
+The label contains inline content but the body has block content.
diff --git a/test/output/2.blocks.html b/test/output/2.blocks.html
index f00b59a..585e3ed 100644
--- a/test/output/2.blocks.html
+++ b/test/output/2.blocks.html
@@ -14,4 +14,4 @@ Hello
Content
-content
\ No newline at end of file
+content
diff --git a/test/output/3.blocks-slots.html b/test/output/3.blocks-slots.html
index d6a4d79..dc02bcf 100644
--- a/test/output/3.blocks-slots.html
+++ b/test/output/3.blocks-slots.html
@@ -4,4 +4,4 @@ Title
This will be rendered inside the description slot.
-
\ No newline at end of file
+
diff --git a/test/output/4.blocks-nesting.html b/test/output/4.blocks-nesting.html
index 177ef8e..e827c57 100644
--- a/test/output/4.blocks-nesting.html
+++ b/test/output/4.blocks-nesting.html
@@ -8,4 +8,4 @@
::hero
Indent 4 spaces, should be treated as code block
::
-
\ No newline at end of file
+
diff --git a/test/output/5.blocks-props.html b/test/output/5.blocks-props.html
index 7529a18..d2d944c 100644
--- a/test/output/5.blocks-props.html
+++ b/test/output/5.blocks-props.html
@@ -1,2 +1,2 @@
Hello
-The content of the card
\ No newline at end of file
+The content of the card
diff --git a/test/output/6.inline-props.html b/test/output/6.inline-props.html
index 051cc45..7a4013a 100644
--- a/test/output/6.inline-props.html
+++ b/test/output/6.inline-props.html
@@ -10,4 +10,4 @@ Hello
code
italic
-bold!
\ No newline at end of file
+bold!
diff --git a/test/output/7.inline-components.html b/test/output/7.inline-components.html
index 6a69883..f0cdaab 100644
--- a/test/output/7.inline-components.html
+++ b/test/output/7.inline-components.html
@@ -23,4 +23,4 @@ Content
inline component
inline component
-content inline component
\ No newline at end of file
+content inline component
diff --git a/test/output/8.inline-span.html b/test/output/8.inline-span.html
index 47cb520..ee4f676 100644
--- a/test/output/8.inline-span.html
+++ b/test/output/8.inline-span.html
@@ -1,4 +1,4 @@
Hello World
Hello World!
Hello World] Yes!
-Hello World!
\ No newline at end of file
+Hello World!
diff --git a/test/output/9.blocks-slots.html b/test/output/9.blocks-slots.html
index 875fb34..f0a39d5 100644
--- a/test/output/9.blocks-slots.html
+++ b/test/output/9.blocks-slots.html
@@ -13,4 +13,4 @@ Title
Baz
-
\ No newline at end of file
+
From 371b905e5fe49f1dd88c1492da4b9cac17a10187 Mon Sep 17 00:00:00 2001
From: Farnabaz
Date: Thu, 9 Apr 2026 11:21:41 +0200
Subject: [PATCH 2/5] feat: add inline content as paragraph in block components
---
src/syntax/block.ts | 10 ++++++++++
test/input/17.markdonw-directive.md | 4 ++++
test/output/17.markdonw-directive.html | 4 ++++
3 files changed, 18 insertions(+)
diff --git a/src/syntax/block.ts b/src/syntax/block.ts
index dafe891..e6d83da 100644
--- a/src/syntax/block.ts
+++ b/src/syntax/block.ts
@@ -233,6 +233,16 @@ export const MarkdownItMdcBlock: MarkdownIt.PluginSimple = (md) => {
})
}
+ // Add bracket content as first paragraph `::bloc[Content]\n::`
+ if (params.content !== undefined) {
+ const pOpen = state.push('paragraph_open', 'p', 1)
+ pOpen.map = [startLine, startLine + 1]
+ const inline = state.push('inline', '', 0)
+ inline.content = params.content
+ inline.children = []
+ state.push('paragraph_close', 'p', -1)
+ }
+
// Parse content
const blkIndent = state.blkIndent
state.blkIndent = indent
diff --git a/test/input/17.markdonw-directive.md b/test/input/17.markdonw-directive.md
index d388e05..8bfa70f 100644
--- a/test/input/17.markdonw-directive.md
+++ b/test/input/17.markdonw-directive.md
@@ -11,3 +11,7 @@ The label contains inline content but the body has block content.
::: note{type="info"}
The label contains inline content but the body has block content.
:::
+
+::: note[Important Notice]{type="info"}
+The label contains inline content but the body has block content.
+:::
diff --git a/test/output/17.markdonw-directive.html b/test/output/17.markdonw-directive.html
index fd321c0..c20502b 100644
--- a/test/output/17.markdonw-directive.html
+++ b/test/output/17.markdonw-directive.html
@@ -7,3 +7,7 @@
The label contains inline content but the body has block content.
+
+ Important Notice
+ The label contains inline content but the body has block content.
+
From 6e2d4e8d95d34a94bbb08c5663f78b5bd180677c Mon Sep 17 00:00:00 2001
From: Farnabaz
Date: Thu, 9 Apr 2026 11:24:20 +0200
Subject: [PATCH 3/5] update test
---
test/input/17.markdonw-directive.md | 2 +-
test/output/17.markdonw-directive.html | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/input/17.markdonw-directive.md b/test/input/17.markdonw-directive.md
index 8bfa70f..ea1799d 100644
--- a/test/input/17.markdonw-directive.md
+++ b/test/input/17.markdonw-directive.md
@@ -12,6 +12,6 @@ The label contains inline content but the body has block content.
The label contains inline content but the body has block content.
:::
-::: note[Important Notice]{type="info"}
+::: note[**Important** Notice]{type="info"}
The label contains inline content but the body has block content.
:::
diff --git a/test/output/17.markdonw-directive.html b/test/output/17.markdonw-directive.html
index c20502b..ba5cdeb 100644
--- a/test/output/17.markdonw-directive.html
+++ b/test/output/17.markdonw-directive.html
@@ -8,6 +8,6 @@
>The label contains inline content but the body has block content.
- Important Notice
+ Important Notice
The label contains inline content but the body has block content.
From 46050a5c20d69e3bbffc24278fb853c29996858e Mon Sep 17 00:00:00 2001
From: Farnabaz
Date: Thu, 9 Apr 2026 11:38:05 +0200
Subject: [PATCH 4/5] ci: add commit release
---
.github/workflows/ci.yml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 21bdbf3..31b1909 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,3 +85,6 @@ jobs:
- name: Test
run: nr test
+
+ - name: Publish
+ run: pnpx pkg-pr-new publish --compact --no-template --pnpm
From 0d4b15e8de4ee85117d4c6dd6a4a20b4a9df33f7 Mon Sep 17 00:00:00 2001
From: Farnabaz
Date: Thu, 9 Apr 2026 12:46:28 +0200
Subject: [PATCH 5/5] ci: publish on linux os
---
.github/workflows/ci.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 31b1909..d6e3d44 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -87,4 +87,5 @@ jobs:
run: nr test
- name: Publish
+ if: runner.os == 'Linux'
run: pnpx pkg-pr-new publish --compact --no-template --pnpm