Repository navigation
fix(render): don't indent a nested component that follows a list #537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9cbdc48
fix(render): don't indent a nested component that follows a list
danielroe e482afd
test(render): cover components after lists inside named slots
farnabaz 51bd992
Merge branch 'main' into fix-4
farnabaz 287d6b9
update lockfile
farnabaz 917aef0
chore: update bundle size test
farnabaz 322ff8c
Create component-nested-in-list.md
farnabaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
101 changes: 101 additions & 0 deletions
101
packages/comark/SPEC/COMARK/component-nested-after-list.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| ## Input | ||
|
|
||
| ```md | ||
| ::steps | ||
| ### Prerequisites | ||
|
|
||
| - **Node.js** - `22.x` or newer | ||
| - **Terminal** - In order to run Nuxt commands | ||
|
|
||
| :::callout | ||
| Make sure to use an even numbered version. | ||
| ::: | ||
| :: | ||
| ``` | ||
|
|
||
| ## AST | ||
|
|
||
| ```json | ||
| { | ||
| "frontmatter": {}, | ||
| "meta": {}, | ||
| "nodes": [ | ||
| [ | ||
| "steps", | ||
| {}, | ||
| [ | ||
| "h3", | ||
| { | ||
| "id": "prerequisites" | ||
| }, | ||
| "Prerequisites" | ||
| ], | ||
| [ | ||
| "ul", | ||
| {}, | ||
| [ | ||
| "li", | ||
| {}, | ||
| [ | ||
| "strong", | ||
| {}, | ||
| "Node.js" | ||
| ], | ||
| " - ", | ||
| [ | ||
| "code", | ||
| {}, | ||
| "22.x" | ||
| ], | ||
| " or newer" | ||
| ], | ||
| [ | ||
| "li", | ||
| {}, | ||
| [ | ||
| "strong", | ||
| {}, | ||
| "Terminal" | ||
| ], | ||
| " - In order to run Nuxt commands" | ||
| ] | ||
| ], | ||
| [ | ||
| "callout", | ||
| {}, | ||
| "Make sure to use an even numbered version." | ||
| ] | ||
| ] | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## HTML | ||
|
|
||
| ```html | ||
| <steps> | ||
| <h3 id="prerequisites">Prerequisites</h3> | ||
| <ul> | ||
| <li><strong>Node.js</strong> - <code>22.x</code> or newer</li> | ||
| <li><strong>Terminal</strong> - In order to run Nuxt commands</li> | ||
| </ul> | ||
| <callout> | ||
| Make sure to use an even numbered version. | ||
| </callout> | ||
| </steps> | ||
| ``` | ||
|
|
||
| ## Markdown | ||
|
|
||
| ```md | ||
| ::steps | ||
| ### Prerequisites | ||
|
|
||
| - **Node.js** - `22.x` or newer | ||
| - **Terminal** - In order to run Nuxt commands | ||
|
|
||
| :::callout | ||
| Make sure to use an even numbered version. | ||
| ::: | ||
| :: | ||
| ``` |
105 changes: 105 additions & 0 deletions
105
packages/comark/SPEC/COMARK/component-nested-in-list.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| ## Input | ||
|
|
||
| ```md | ||
| ::steps | ||
| ### Prerequisites | ||
|
|
||
| - **Node.js** - `22.x` or newer | ||
| - **Terminal** - In order to run Nuxt commands | ||
| :::callout | ||
| Make sure to use an even numbered version. | ||
| ::: | ||
| :: | ||
| ``` | ||
|
|
||
| ## AST | ||
|
|
||
| ```json | ||
| { | ||
| "frontmatter": {}, | ||
| "meta": {}, | ||
| "nodes": [ | ||
| [ | ||
| "steps", | ||
| {}, | ||
| [ | ||
| "h3", | ||
| { | ||
| "id": "prerequisites" | ||
| }, | ||
| "Prerequisites" | ||
| ], | ||
| [ | ||
| "ul", | ||
| {}, | ||
| [ | ||
| "li", | ||
| {}, | ||
| [ | ||
| "strong", | ||
| {}, | ||
| "Node.js" | ||
| ], | ||
| " - ", | ||
| [ | ||
| "code", | ||
| {}, | ||
| "22.x" | ||
| ], | ||
| " or newer" | ||
| ], | ||
| [ | ||
| "li", | ||
| {}, | ||
| [ | ||
| "p", | ||
| {}, | ||
| [ | ||
| "strong", | ||
| {}, | ||
| "Terminal" | ||
| ], | ||
| " - In order to run Nuxt commands" | ||
| ], | ||
| [ | ||
| "callout", | ||
| {}, | ||
| "Make sure to use an even numbered version." | ||
| ] | ||
| ] | ||
| ] | ||
| ] | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## HTML | ||
|
|
||
| ```html | ||
| <steps> | ||
| <h3 id="prerequisites">Prerequisites</h3> | ||
| <ul> | ||
| <li><strong>Node.js</strong> - <code>22.x</code> or newer</li> | ||
| <li> | ||
| <p><strong>Terminal</strong> - In order to run Nuxt commands</p> | ||
| <callout> | ||
| Make sure to use an even numbered version. | ||
| </callout> | ||
| </li> | ||
| </ul> | ||
| </steps> | ||
| ``` | ||
|
|
||
| ## Markdown | ||
|
|
||
| ```md | ||
| ::steps | ||
| ### Prerequisites | ||
|
|
||
| - **Node.js** - `22.x` or newer | ||
| - **Terminal** - In order to run Nuxt commands | ||
| :::callout | ||
| Make sure to use an even numbered version. | ||
| ::: | ||
| :: | ||
| ``` |
115 changes: 115 additions & 0 deletions
115
packages/comark/SPEC/COMARK/component-slot-nested-after-list.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| ## Input | ||
|
|
||
| ```md | ||
| ::card | ||
| #title | ||
| Getting started | ||
|
|
||
| #content | ||
| - **Node.js** - `22.x` or newer | ||
| - **Terminal** - In order to run Nuxt commands | ||
|
|
||
| :::callout | ||
| Make sure to use an even numbered version. | ||
| ::: | ||
| :: | ||
| ``` | ||
|
|
||
| ## AST | ||
|
|
||
| ```json | ||
| { | ||
| "frontmatter": {}, | ||
| "meta": {}, | ||
| "nodes": [ | ||
| [ | ||
| "card", | ||
| {}, | ||
| [ | ||
| "template", | ||
| { | ||
| "name": "title" | ||
| }, | ||
| "Getting started" | ||
| ], | ||
| [ | ||
| "template", | ||
| { | ||
| "name": "content" | ||
| }, | ||
| [ | ||
| "ul", | ||
| {}, | ||
| [ | ||
| "li", | ||
| {}, | ||
| [ | ||
| "strong", | ||
| {}, | ||
| "Node.js" | ||
| ], | ||
| " - ", | ||
| [ | ||
| "code", | ||
| {}, | ||
| "22.x" | ||
| ], | ||
| " or newer" | ||
| ], | ||
| [ | ||
| "li", | ||
| {}, | ||
| [ | ||
| "strong", | ||
| {}, | ||
| "Terminal" | ||
| ], | ||
| " - In order to run Nuxt commands" | ||
| ] | ||
| ], | ||
| [ | ||
| "callout", | ||
| {}, | ||
| "Make sure to use an even numbered version." | ||
| ] | ||
| ] | ||
| ] | ||
| ] | ||
| } | ||
| ``` | ||
|
|
||
| ## HTML | ||
|
|
||
| ```html | ||
| <card> | ||
| <template name="title"> | ||
| Getting started | ||
| </template> | ||
| <template name="content"> | ||
| <ul> | ||
| <li><strong>Node.js</strong> - <code>22.x</code> or newer</li> | ||
| <li><strong>Terminal</strong> - In order to run Nuxt commands</li> | ||
| </ul> | ||
| <callout> | ||
| Make sure to use an even numbered version. | ||
| </callout> | ||
| </template> | ||
| </card> | ||
| ``` | ||
|
|
||
| ## Markdown | ||
|
|
||
| ```md | ||
| ::card | ||
| #title | ||
| Getting started | ||
|
|
||
| #content | ||
| - **Node.js** - `22.x` or newer | ||
| - **Terminal** - In order to run Nuxt commands | ||
|
|
||
| :::callout | ||
| Make sure to use an even numbered version. | ||
| ::: | ||
| :: | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
cat packages/comark/src/internal/stringify/handlers/mdc.ts cat packages/comark/src/internal/stringify/handlers/template.ts rg -n 'comark_block_slots' packages/comark/srcRepository: comarkdown/comark
Length of output: 4433
Script executed:
Repository: comarkdown/comark
Length of output: 18943
Script executed:
Repository: comarkdown/comark
Length of output: 12528
Script executed:
Repository: comarkdown/comark
Length of output: 10926
Script executed:
Repository: comarkdown/comark
Length of output: 1584
Keep components after lists inside named slots.
state.flowpasses thetemplatenode as the parent to each slot child. When the previous child is a list,mdcemits the following non-inline component with indentation level0. During reparsing,comark_block_slotstreats the resulting::-prefixed fence as the end of the slot. The component can therefore move outside its named slot.Use an indentation rule that keeps the component inside the slot while remaining outside the preceding list, or update
comark_block_slotsto distinguish nested component fences from the end of a slot.