Files
bbe5917a16 feat(mdx): support VS Code-style #region extraction for <include /> (#2791)
* feat(include): support VS Code-style #region extraction for code files

* chore: add changeset for include code region support

* improve perf & fix bugs

* Docs: introduce region support

---------

Co-authored-by: Fuma Nama <[email protected]>
2025-12-20 18:06:57 +08:00

374 lines
8.1 KiB
Plaintext

{
"children": [
{
"children": [
{
"position": undefined,
"type": "text",
"value": "Using JSX",
},
],
"depth": 2,
"position": undefined,
"type": "heading",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "Full:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./test.mdx",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "First Heading:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./test.mdx#heading",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "In JSX:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./test.mdx#section-in-jsx",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "In Directive:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./test.mdx#section-in-directive",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "Using Directives",
},
],
"depth": 2,
"position": undefined,
"type": "heading",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "In Directive:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"attributes": {},
"children": [
{
"children": [
{
"position": undefined,
"type": "text",
"value": "./test.mdx#section-in-directive",
},
],
"position": undefined,
"type": "paragraph",
},
],
"name": "include",
"position": undefined,
"type": "containerDirective",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "Inline Directive:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"attributes": {},
"children": [
{
"position": undefined,
"type": "text",
"value": "./test.mdx#section-in-directive",
},
],
"name": "include",
"position": undefined,
"type": "leafDirective",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "Code",
},
],
"depth": 2,
"position": undefined,
"type": "heading",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./code.ts",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "With Region:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./code.ts#a",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"position": undefined,
"type": "text",
"value": "With Nested Region:",
},
],
"position": undefined,
"type": "paragraph",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./code.ts#b",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
{
"children": [
{
"children": [
{
"attributes": [],
"children": [
{
"position": undefined,
"type": "text",
"value": "./code.ts#c",
},
],
"name": "include",
"position": undefined,
"type": "mdxJsxTextElement",
},
],
"position": undefined,
"type": "paragraph",
},
],
"position": undefined,
"type": "blockquote",
},
],
"position": undefined,
"type": "root",
}