Skip to content

Commit

Permalink
fix(plugin-container-syntax): typical markdown blockquote syntax thro…
Browse files Browse the repository at this point in the history
…wing error (#1494)

Co-authored-by: Timeless0911 <[email protected]>
  • Loading branch information
ArnavK-09 and Timeless0911 authored Oct 17, 2024
1 parent 2e8a9e3 commit 2c4940a
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 1 deletion.
44 changes: 44 additions & 0 deletions e2e/fixtures/github-alert/doc/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Hello World

> [!TIP]
> This is a 'tip' style block.
> [!NOTE]
> This is a 'note' style block.
> [!WARNING]
> This is a 'warning' style block.
> [!CAUTION]
> This is a 'caution' style block.
> [!DANGER]
> This is a 'danger' style block.
> [!INFO]
> This is an 'info' style block.
> [!DETAILS]
> This is a 'details' style block.
> # This is a heading inside a blockquote
> **Bold text**
> _Italic text_
> [foo](bar)
> `Inline code`
> ```javascript
> // This is a code block
> console.log('Hello, World!');
> ```
> - List item 1
> - List item 2
>
> > Nested blockquote
>
> ![Image Alt Text](https://github.com/web-infra-dev/rspress/assets/39261479/999e7946-45ff-45d5-b9cd-594e634e0e5a)
16 changes: 16 additions & 0 deletions e2e/fixtures/github-alert/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@rspress-fixture/github-alert",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "rspress dev",
"build": "rspress build",
"preview": "rspress preview"
},
"dependencies": {
"rspress": "workspace:*"
},
"devDependencies": {
"@types/node": "^18.11.17"
}
}
9 changes: 9 additions & 0 deletions e2e/fixtures/github-alert/rspress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as path from 'node:path';
import { defineConfig } from 'rspress/config';

export default defineConfig({
root: path.join(__dirname, 'doc'),
markdown: {
mdxRs: false,
},
});
1 change: 1 addition & 0 deletions e2e/fixtures/github-alert/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 1 addition & 1 deletion packages/plugin-container-syntax/src/remarkPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function transformer(tree: Root) {
if (node.type === 'blockquote' && node.children[0].type === 'paragraph') {
const initiaterTag: string =
// @ts-expect-error `value` is treated like `data`, but type expects `data`
node.children[0].children[0].value.toString();
node.children[0].children[0].value;

if (REGEX_GH_BEGIN.test(initiaterTag)) {
const match = initiaterTag.match(REGEX_GH_BEGIN);
Expand Down
10 changes: 10 additions & 0 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 2c4940a

Please sign in to comment.