Skip to content

Commit 20c1a00

Browse files
committed
feat: headings id and mixed inline components
1 parent 1599057 commit 20c1a00

16 files changed

Lines changed: 819 additions & 103 deletions

SPEC/MDC/frontmatter-basic.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ description: My Description
2323
"value": [
2424
[
2525
"h1",
26-
{},
26+
{
27+
"id": "content"
28+
},
2729
"Content"
2830
]
2931
]
@@ -33,7 +35,7 @@ description: My Description
3335
## HTML
3436

3537
```html
36-
<h1>Content</h1>
38+
<h1 id="content">Content</h1>
3739
```
3840

3941
## Markdown

SPEC/MDC/frontmatter-empty.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ timeout:
2929
],
3030
[
3131
"h1",
32-
{},
32+
{
33+
"id": "content"
34+
},
3335
"Content"
3436
]
3537
]
@@ -41,7 +43,7 @@ timeout:
4143
```html
4244
<hr />
4345
<hr />
44-
<h1>Content</h1>
46+
<h1 id="content">Content</h1>
4547
```
4648

4749
## Markdown

SPEC/MDC/inline-component-mixed.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
timeout:
3+
parse: 5ms
4+
html: 5ms
5+
markdown: 5ms
6+
---
7+
8+
## Input
9+
10+
```md
11+
[:component[text]{.class}](/link)
12+
13+
**:component[text]{.class}**
14+
15+
*:component[text]{.class}*
16+
17+
[:component[text]{.class}]
18+
```
19+
20+
## AST
21+
22+
```json
23+
{
24+
"type": "minimark",
25+
"value": [
26+
[
27+
"p",
28+
{},
29+
[
30+
"a",
31+
{
32+
"href": "/link"
33+
},
34+
[
35+
"component",
36+
{
37+
"class": "class"
38+
},
39+
"text"
40+
]
41+
]
42+
],
43+
[
44+
"p",
45+
{},
46+
[
47+
"strong",
48+
{},
49+
[
50+
"component",
51+
{
52+
"class": "class"
53+
},
54+
"text"
55+
]
56+
]
57+
],
58+
[
59+
"p",
60+
{},
61+
[
62+
"em",
63+
{},
64+
[
65+
"component",
66+
{
67+
"class": "class"
68+
},
69+
"text"
70+
]
71+
]
72+
],
73+
[
74+
"p",
75+
{},
76+
[
77+
"span",
78+
{},
79+
[
80+
"component",
81+
{
82+
"class": "class"
83+
},
84+
"text"
85+
]
86+
]
87+
]
88+
]
89+
}
90+
```
91+
92+
## HTML
93+
94+
```html
95+
<p><a href="/link">
96+
<component class="class">
97+
text
98+
</component>
99+
</a></p>
100+
<p><strong>
101+
<component class="class">
102+
text
103+
</component>
104+
</strong></p>
105+
<p><em>
106+
<component class="class">
107+
text
108+
</component>
109+
</em></p>
110+
<p><span>
111+
<component class="class">
112+
text
113+
</component>
114+
</span></p>
115+
```
116+
117+
## Markdown
118+
119+
```md
120+
[:component[text]{.class}](/link)
121+
122+
**:component[text]{.class}**
123+
124+
*:component[text]{.class}*
125+
126+
[:component[text]{.class}]
127+
```
128+

SPEC/MDC/inline-component.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ Paragraph with :inline-component in middle
5252
],
5353
[
5454
"h2",
55-
{},
55+
{
56+
"id": "a-inline-inside-heading"
57+
},
5658
"a ",
5759
[
5860
"inline",
@@ -76,7 +78,7 @@ Paragraph with :inline-component in middle
7678
<p>
7779
Paragraph with <inline-component></inline-component> in middle
7880
</p>
79-
<h2>
81+
<h2 id="a-inline-inside-heading">
8082
a <inline></inline> inside heading
8183
</h2>
8284
```

SPEC/common-mark/blockquote-heading-paragraph.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ timeout:
2424
{},
2525
[
2626
"h4",
27-
{},
27+
{
28+
"id": "the-quarterly-results-look-great"
29+
},
2830
"The quarterly results look great!"
2931
],
3032
[
@@ -41,7 +43,7 @@ timeout:
4143

4244
```html
4345
<blockquote>
44-
<h4>The quarterly results look great!</h4>
46+
<h4 id="the-quarterly-results-look-great">The quarterly results look great!</h4>
4547
<p>Paragraph</p>
4648
</blockquote>
4749
```

SPEC/common-mark/blockquote-heading.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ timeout:
2222
{},
2323
[
2424
"h4",
25-
{},
25+
{
26+
"id": "the-quarterly-results-look-great"
27+
},
2628
"The quarterly results look great!"
2729
]
2830
]
@@ -34,7 +36,7 @@ timeout:
3436

3537
```html
3638
<blockquote>
37-
<h4>The quarterly results look great!</h4>
39+
<h4 id="the-quarterly-results-look-great">The quarterly results look great!</h4>
3840
</blockquote>
3941
```
4042

SPEC/common-mark/headings-id.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
timeout:
3+
parse: 5ms
4+
html: 5ms
5+
markdown: 5ms
6+
---
7+
8+
## Input
9+
10+
```md
11+
# Hello
12+
13+
# Hello World
14+
15+
## C. Great
16+
17+
## 1. Introduction
18+
19+
## ending space
20+
21+
### Slash - in - Title
22+
23+
### -Starting dash
24+
25+
### Ending dash-
26+
27+
### -Dash-
28+
```
29+
30+
## AST
31+
32+
```json
33+
{
34+
"type": "minimark",
35+
"value": [
36+
[
37+
"h1",
38+
{
39+
"id": "hello"
40+
},
41+
"Hello"
42+
],
43+
[
44+
"h1",
45+
{
46+
"id": "hello-world"
47+
},
48+
"Hello World"
49+
],
50+
[
51+
"h2",
52+
{
53+
"id": "c-great"
54+
},
55+
"C. Great"
56+
],
57+
[
58+
"h2",
59+
{
60+
"id": "_1-introduction"
61+
},
62+
"1. Introduction"
63+
],
64+
[
65+
"h2",
66+
{
67+
"id": "ending-space"
68+
},
69+
"ending space"
70+
],
71+
[
72+
"h3",
73+
{
74+
"id": "slash-in-title"
75+
},
76+
"Slash - in - Title"
77+
],
78+
[
79+
"h3",
80+
{
81+
"id": "starting-dash"
82+
},
83+
"-Starting dash"
84+
],
85+
[
86+
"h3",
87+
{
88+
"id": "ending-dash"
89+
},
90+
"Ending dash-"
91+
],
92+
[
93+
"h3",
94+
{
95+
"id": "dash"
96+
},
97+
"-Dash-"
98+
]
99+
]
100+
}
101+
```
102+
103+
## HTML
104+
105+
```html
106+
<h1 id="hello">Hello</h1>
107+
<h1 id="hello-world">Hello World</h1>
108+
<h2 id="c-great">C. Great</h2>
109+
<h2 id="_1-introduction">1. Introduction</h2>
110+
<h2 id="ending-space">ending space</h2>
111+
<h3 id="slash-in-title">Slash - in - Title</h3>
112+
<h3 id="starting-dash">-Starting dash</h3>
113+
<h3 id="ending-dash">Ending dash-</h3>
114+
<h3 id="dash">-Dash-</h3>
115+
```
116+
117+
## Markdown
118+
119+
```md
120+
# Hello
121+
122+
# Hello World
123+
124+
## C. Great
125+
126+
## 1. Introduction
127+
128+
## ending space
129+
130+
### Slash - in - Title
131+
132+
### -Starting dash
133+
134+
### Ending dash-
135+
136+
### -Dash-
137+
```

0 commit comments

Comments
 (0)