mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-28 07:09:50 +00:00
* 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]>
700 lines
17 KiB
Plaintext
700 lines
17 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": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Hello World [#heading]",
|
|
},
|
|
],
|
|
"depth": 1,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Hey there!",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"position": {
|
|
"end": {
|
|
"column": 29,
|
|
"line": 5,
|
|
"offset": 66,
|
|
},
|
|
"start": {
|
|
"column": 10,
|
|
"line": 5,
|
|
"offset": 47,
|
|
},
|
|
},
|
|
"type": "mdxJsxAttribute",
|
|
"value": "section-in-jsx",
|
|
},
|
|
],
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "This is My Test.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Nested Heading",
|
|
},
|
|
],
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"lang": "ts",
|
|
"meta": null,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "console.log('Hello World');",
|
|
},
|
|
],
|
|
"name": "section",
|
|
"position": undefined,
|
|
"type": "mdxJsxFlowElement",
|
|
},
|
|
{
|
|
"attributes": {
|
|
"id": "section-in-directive",
|
|
},
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Heading in Directive",
|
|
},
|
|
],
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "some content inside.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
],
|
|
"name": "section",
|
|
"position": undefined,
|
|
"type": "containerDirective",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "root",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "blockquote",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "First Heading:",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Hello World",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "heading",
|
|
},
|
|
},
|
|
"depth": 1,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Hey there!",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"attributes": [
|
|
{
|
|
"name": "id",
|
|
"position": {
|
|
"end": {
|
|
"column": 29,
|
|
"line": 5,
|
|
"offset": 66,
|
|
},
|
|
"start": {
|
|
"column": 10,
|
|
"line": 5,
|
|
"offset": 47,
|
|
},
|
|
},
|
|
"type": "mdxJsxAttribute",
|
|
"value": "section-in-jsx",
|
|
},
|
|
],
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "This is My Test.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Nested Heading",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "nested-heading",
|
|
},
|
|
},
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"lang": "ts",
|
|
"meta": null,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "console.log('Hello World');",
|
|
},
|
|
],
|
|
"name": "section",
|
|
"position": undefined,
|
|
"type": "mdxJsxFlowElement",
|
|
},
|
|
{
|
|
"attributes": {
|
|
"id": "section-in-directive",
|
|
},
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Heading in Directive",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "heading-in-directive",
|
|
},
|
|
},
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "some content inside.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
],
|
|
"name": "section",
|
|
"position": undefined,
|
|
"type": "containerDirective",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "root",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "blockquote",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "In JSX:",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "This is My Test.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Nested Heading",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "nested-heading",
|
|
},
|
|
},
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"lang": "ts",
|
|
"meta": null,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "console.log('Hello World');",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "root",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "blockquote",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "In Directive:",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Heading in Directive",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "heading-in-directive",
|
|
},
|
|
},
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "some content inside.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "root",
|
|
},
|
|
],
|
|
"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": "Heading in Directive",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "heading-in-directive",
|
|
},
|
|
},
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "some content inside.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
],
|
|
"name": "include",
|
|
"position": undefined,
|
|
"type": "root",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "blockquote",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Inline Directive:",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"attributes": {},
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "Heading in Directive",
|
|
},
|
|
],
|
|
"data": {
|
|
"hProperties": {
|
|
"id": "heading-in-directive",
|
|
},
|
|
},
|
|
"depth": 3,
|
|
"position": undefined,
|
|
"type": "heading",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "some content inside.",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "paragraph",
|
|
},
|
|
],
|
|
"name": "include",
|
|
"position": undefined,
|
|
"type": "root",
|
|
},
|
|
],
|
|
"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",
|
|
},
|
|
],
|
|
"data": {},
|
|
"lang": "ts",
|
|
"meta": undefined,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "//#region a
|
|
console.log('hello world');
|
|
//#endregion
|
|
|
|
export function fn() {
|
|
//#region b
|
|
console.log('one');
|
|
//#region c
|
|
return function nested() {
|
|
console.log('two');
|
|
//#endregion
|
|
console.log('three');
|
|
};
|
|
//#endregion
|
|
}
|
|
",
|
|
},
|
|
],
|
|
"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",
|
|
},
|
|
],
|
|
"data": {},
|
|
"lang": "ts",
|
|
"meta": undefined,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "console.log('hello world');",
|
|
},
|
|
],
|
|
"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",
|
|
},
|
|
],
|
|
"data": {},
|
|
"lang": "ts",
|
|
"meta": undefined,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "console.log('one');
|
|
return function nested() {
|
|
console.log('two');
|
|
console.log('three');
|
|
};",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "blockquote",
|
|
},
|
|
{
|
|
"children": [
|
|
{
|
|
"children": [
|
|
{
|
|
"attributes": [],
|
|
"children": [
|
|
{
|
|
"position": undefined,
|
|
"type": "text",
|
|
"value": "./code.ts#c",
|
|
},
|
|
],
|
|
"name": "include",
|
|
"position": undefined,
|
|
"type": "mdxJsxTextElement",
|
|
},
|
|
],
|
|
"data": {},
|
|
"lang": "ts",
|
|
"meta": undefined,
|
|
"position": undefined,
|
|
"type": "code",
|
|
"value": "return function nested() {
|
|
console.log('two');",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "blockquote",
|
|
},
|
|
],
|
|
"position": undefined,
|
|
"type": "root",
|
|
} |