Skip to content

Commit

Permalink
chore: update ordered list content
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jan 10, 2025
1 parent 7ef32df commit b7d2f2e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions e2e/fixtures/github-alert-mdxjs/doc/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
1. Title
> [!INFO]
> This is a 'info' style block.
> [!INFO]
> This is a 'info' style block.
- Title
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/github-alert-mdxjs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ test.describe('github alert syntax in mdx-js', async () => {
'.rspress-doc > [class^="rspress-directive"]',
);

expect(topLevelDirectives.length).toEqual(8);
expect(topLevelDirectives.length).toEqual(7);

const listDirectives = await page.$$(
'.rspress-doc > ul > li > [class^="rspress-directive"]',
'.rspress-doc > * > li > [class^="rspress-directive"]',
);
expect(listDirectives.length).toEqual(1);
expect(listDirectives.length).toEqual(2);

const containerTypes = await Promise.all(
[...topLevelDirectives, ...listDirectives].map(async directive => {
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-container-syntax/src/remarkPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ function transformer(tree: Parent) {
while (i < tree.children.length) {
const node = tree.children[i];

console.log(JSON.stringify(node, null, 2));

// The list ast must be traversed to find the container directive,
// especially for the unordered list whose ast is very different
if (node.type === 'list') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,21 +77,27 @@ exports[`remark-container > nested in list - github alerts 1`] = `
exports[`remark-container > nested in ordered list 1`] = `
"<ol>
<li>Title1</li>
</ol>
<li>
<p>Title1</p>
<div class="rspress-directive tip"><div class="rspress-directive-title">TIP</div><div class="rspress-directive-content"><p>
This is a tip.</p></div></div>
<ol start="2">
<li>Title2</li>
</li>
<li>
<p>Title2</p>
</li>
</ol>"
`;
exports[`remark-container > nested in ordered list inside mdx component 1`] = `
"<div><div><div><ol>
<li>Title1</li>
</ol><div class="rspress-directive tip"><div class="rspress-directive-title">TIP</div><div class="rspress-directive-content"><p>
This is a tip.</p></div></div><ol start="2">
<li>Title2</li>
<li>
<p>Title1</p>
<div class="rspress-directive tip"><div class="rspress-directive-title">TIP</div><div class="rspress-directive-content"><p>
This is a tip.</p></div></div>
</li>
<li>
<p>Title2</p>
</li>
</ol></div></div></div>"
`;
Expand Down
18 changes: 9 additions & 9 deletions packages/plugin-container-syntax/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ This is a details block.
const result = processor.processSync(`
1. Title1
:::tip
This is a tip.
:::
:::tip
This is a tip.
:::
2. Title2
`);
Expand All @@ -206,9 +206,9 @@ This is a details block.
const result = processor.processSync(`
- Title1
:::tip
This is a tip.
:::
:::tip
This is a tip.
:::
- Title2
`);
Expand All @@ -223,9 +223,9 @@ This is a details block.
<div>
1. Title1
:::tip
This is a tip.
:::
:::tip
This is a tip.
:::
2. Title2
</div>
Expand Down

0 comments on commit b7d2f2e

Please sign in to comment.