-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support nested container syntax in component
- Loading branch information
Showing
7 changed files
with
187 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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
13 changes: 13 additions & 0 deletions
13
...s/mdx_rs/src/snapshots/mdx_rs__tests__compile_container_nested_in_list_and_component.snap
This file contains 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,13 @@ | ||
--- | ||
source: crates/mdx_rs/src/lib.rs | ||
expression: result | ||
--- | ||
CompileResult { | ||
code: "import { useMDXComponents as _provideComponents } from \"@mdx-js/react\";\nfunction _createMdxContent(props) {\n const _components = Object.assign({\n div: \"div\",\n p: \"p\"\n }, _provideComponents(), props.components);\n return <_components.div className=\"rspress-directive tip\"><_components.div className=\"rspress-directive-title\">{\"TIP\"}</_components.div><_components.div className=\"rspress-directive-content\"><_components.p>{\"This is a tip\"}</_components.p></_components.div></_components.div>;\n}\nfunction MDXContent(props = {}) {\n const { wrapper: MDXLayout } = Object.assign({}, _provideComponents(), props.components);\n return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props}/></MDXLayout> : _createMdxContent(props);\n}\nexport default MDXContent;\n", | ||
links: [], | ||
html: "<div><div>TIP</div><div><p>This is a tip</p></div></div>", | ||
title: "", | ||
toc: [], | ||
languages: [], | ||
frontmatter: "{}", | ||
} |
13 changes: 13 additions & 0 deletions
13
...x_rs/src/snapshots/mdx_rs__tests__compile_container_nested_in_list_and_component_mdx.snap
This file contains 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,13 @@ | ||
--- | ||
source: crates/mdx_rs/src/lib.rs | ||
expression: result | ||
--- | ||
CompileResult { | ||
code: "import { useMDXComponents as _provideComponents } from \"@mdx-js/react\";\nfunction _createMdxContent(props) {\n const _components = Object.assign({\n ul: \"ul\",\n li: \"li\",\n p: \"p\",\n div: \"div\"\n }, _provideComponents(), props.components), { Steps } = _components;\n if (!Steps) _missingMdxReference(\"Steps\", true, \"2:1-8:9\");\n return <Steps><_components.ul>{\"\\n\"}<_components.li>{\"\\n\"}<_components.p>{\"Title\"}</_components.p>{\"\\n\"}<_components.div className=\"rspress-directive tip\"><_components.div className=\"rspress-directive-title\">{\"TIP\"}</_components.div><_components.div className=\"rspress-directive-content\"><_components.p>{\"This is a tip\"}</_components.p></_components.div></_components.div>{\"\\n\"}</_components.li>{\"\\n\"}</_components.ul></Steps>;\n}\nfunction MDXContent(props = {}) {\n const { wrapper: MDXLayout } = Object.assign({}, _provideComponents(), props.components);\n return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props}/></MDXLayout> : _createMdxContent(props);\n}\nexport default MDXContent;\nfunction _missingMdxReference(id, component, place) {\n throw new Error(\"Expected \" + (component ? \"component\" : \"object\") + \" `\" + id + \"` to be defined: you likely forgot to import, pass, or provide it.\" + (place ? \"\\nIt’s referenced in your code at `\" + place + \"` in `test.mdx`\" : \"\"));\n}\n", | ||
links: [], | ||
html: "", | ||
title: "", | ||
toc: [], | ||
languages: [], | ||
frontmatter: "{}", | ||
} |
21 changes: 21 additions & 0 deletions
21
crates/mdx_rs/src/snapshots/mdx_rs__tests__compile_custom_title.snap
This file contains 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,21 @@ | ||
--- | ||
source: crates/mdx_rs/src/lib.rs | ||
expression: result | ||
--- | ||
CompileResult { | ||
code: "import { useMDXComponents as _provideComponents } from \"@mdx-js/react\";\nfunction _createMdxContent(props) {\n const _components = Object.assign({\n h2: \"h2\",\n a: \"a\"\n }, _provideComponents(), props.components);\n return <_components.h2 id=\"custom-title\">{\"Container Title\"}<_components.a className=\"header-anchor\" aria-hidden=\"true\" href=\"#custom-title\">{\"#\"}</_components.a></_components.h2>;\n}\nfunction MDXContent(props = {}) {\n const { wrapper: MDXLayout } = Object.assign({}, _provideComponents(), props.components);\n return MDXLayout ? <MDXLayout {...props}><_createMdxContent {...props}/></MDXLayout> : _createMdxContent(props);\n}\nexport default MDXContent;\n", | ||
links: [ | ||
"#custom-title", | ||
], | ||
html: "<h2 id=\"custom-title\">Container Title<a aria-hidden=\"true\" href=\"#custom-title\">#</a></h2>", | ||
title: "", | ||
toc: [ | ||
TocItem { | ||
text: "Container Title", | ||
depth: 2, | ||
id: "custom-title", | ||
}, | ||
], | ||
languages: [], | ||
frontmatter: "{}", | ||
} |
This file contains 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