Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Timeless0911 committed Nov 7, 2024
1 parent 0f08bdd commit f71c716
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 29 deletions.
35 changes: 35 additions & 0 deletions e2e/tests/inline-markdown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,39 @@ test.describe('Inline markdown test', async () => {
].join(','),
);
});

test('Should generate header anchor and id with inline markdown syntax correctly', async ({
page,
}) => {
await page.goto(`http://localhost:${appPort}/inline/all`, {
waitUntil: 'networkidle',
});

// Check h1 element
const h1 = await page.$('h1#class-componentp-s');
expect(h1).not.toBeNull();
const h1Anchor = await h1?.$('a.header-anchor');
expect(await h1Anchor?.getAttribute('href')).toBe('#class-componentp-s');

// Check h2 elements
const h2Selectors = [
'h2#class-componentp-s-1',
'h2#class-componentp-s-2',
'h2#-m-number',
'h2#foo',
'h2#foo-bar-baz',
'h2#bold',
'h2#emphasis',
'h2#delete',
];

for (const selector of h2Selectors) {
const h2 = await page.$(selector);
expect(h2).not.toBeNull();
const h2Anchor = await h2?.$('a.header-anchor');
expect(await h2Anchor?.getAttribute('href')).toBe(
`#${selector.split('#')[1]}`,
);
}
});
});
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@rsbuild/plugin-less": "~1.0.3",
"@rsbuild/plugin-react": "~1.0.6",
"@rsbuild/plugin-sass": "~1.0.4",
"@rspress/mdx-rs": "0.6.2",
"@rspress/mdx-rs": "0.6.3",
"@rspress/plugin-auto-nav-sidebar": "workspace:*",
"@rspress/plugin-container-syntax": "workspace:*",
"@rspress/plugin-last-updated": "workspace:*",
Expand Down
56 changes: 28 additions & 28 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f71c716

Please sign in to comment.