diff --git a/src/utils.ts b/src/utils.ts
index c6da8bc..a79f247 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -113,7 +113,9 @@ export function discoverMarkdownComponents(edge: Edge, prefix: string) {
* Collect components with the tagName.
*/
const tagName = componentName.replace(new RegExp(componentsBasePath), '')
- result[string.dashCase(tagName)] = componentName
+ const lowerTagName = tagName.toLowerCase()
+ const isHeadingTag = /^h[1-6]$/.test(lowerTagName)
+ result[isHeadingTag ? lowerTagName : string.dashCase(tagName)] = componentName
return result
}, {})
}
diff --git a/tests/fixtures/views/components/markdown/H5.edge b/tests/fixtures/views/components/markdown/H5.edge
new file mode 100644
index 0000000..7c0754f
--- /dev/null
+++ b/tests/fixtures/views/components/markdown/H5.edge
@@ -0,0 +1,4 @@
+
+ @markdownSlot()
+
+
diff --git a/tests/fixtures/views/components/markdown/h6.edge b/tests/fixtures/views/components/markdown/h6.edge
new file mode 100644
index 0000000..b473097
--- /dev/null
+++ b/tests/fixtures/views/components/markdown/h6.edge
@@ -0,0 +1,4 @@
+
+ @markdownSlot()
+
+
diff --git a/tests/markdown.spec.ts b/tests/markdown.spec.ts
index cede005..2cf5df7 100644
--- a/tests/markdown.spec.ts
+++ b/tests/markdown.spec.ts
@@ -350,6 +350,38 @@ Here is a paragraph with a [link](./foo)\`
assert.notInclude(result.content, 'Section content')
})
+ test('use h6 component to override h6 rendering', async ({ assert }) => {
+ const edge = new Edge()
+ edge.mount(join(import.meta.dirname, 'fixtures/views'))
+ edge.use(edgeMarkdown, {})
+
+ const renderer = edge.share({})
+ const result = await renderer.getState().$markdown.render({
+ content: dedent`
+ ###### Section title
+ `,
+ })
+
+ assert.include(result.content, 'class="custom-h6"')
+ assert.notMatch(result.content, / {
+ const edge = new Edge()
+ edge.mount(join(import.meta.dirname, 'fixtures/views'))
+ edge.use(edgeMarkdown, {})
+
+ const renderer = edge.share({})
+ const result = await renderer.getState().$markdown.render({
+ content: dedent`
+ ##### Section title
+ `,
+ })
+
+ assert.include(result.content, 'class="custom-h5"')
+ assert.notMatch(result.content, / {
const edge = new Edge()
edge.mount(join(import.meta.dirname, 'fixtures/views'))