@docubook/create 2.0.0-beta.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/dist/app/page.tsx +11 -11
- package/src/dist/components/markdown/AccordionMdx.tsx +2 -2
- package/src/dist/components/ui/table.tsx +3 -3
- package/src/dist/contents/docs/getting-started/development/index.mdx +40 -11
- package/src/dist/contents/docs/getting-started/introduction/index.mdx +39 -21
- package/src/dist/contents/docs/getting-started/quick-start-guide/index.mdx +40 -11
- package/src/dist/lib/markdown.ts +21 -12
- package/src/dist/package.json +1 -1
package/package.json
CHANGED
package/src/dist/app/page.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buttonVariants } from "@/components/ui/button";
|
|
2
2
|
import { page_routes } from "@/lib/routes-config";
|
|
3
|
-
import { ArrowRightIcon,
|
|
3
|
+
import { ArrowRightIcon, Terminal, AppWindow, FileText } from "lucide-react";
|
|
4
4
|
import Link from "next/link";
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
import AnimatedShinyText from "@/components/ui/animated-shiny-text";
|
|
@@ -25,7 +25,7 @@ export default function Home() {
|
|
|
25
25
|
)}
|
|
26
26
|
>
|
|
27
27
|
<AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200">
|
|
28
|
-
<span>🚀 Release v2.0.0
|
|
28
|
+
<span>🚀 Release v2.0.0</span>
|
|
29
29
|
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
|
|
30
30
|
</AnimatedShinyText>
|
|
31
31
|
</div>
|
|
@@ -65,29 +65,29 @@ export default function Home() {
|
|
|
65
65
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-8 py-12">
|
|
66
66
|
<Card className="px-2 py-6">
|
|
67
67
|
<CardHeader className="flex flex-row justify-center items-center gap-3">
|
|
68
|
-
<
|
|
69
|
-
<CardTitle className="text-xl">
|
|
68
|
+
<Terminal className="size-6 text-primary" />
|
|
69
|
+
<CardTitle className="text-xl">Advanced Code Blocks</CardTitle>
|
|
70
70
|
</CardHeader>
|
|
71
71
|
<CardContent>
|
|
72
|
-
<p>
|
|
72
|
+
<p>Write amazing code blocks with syntax highlighting, line numbers, and line highlighting.</p>
|
|
73
73
|
</CardContent>
|
|
74
74
|
</Card>
|
|
75
75
|
<Card className="px-2 py-6">
|
|
76
76
|
<CardHeader className="flex flex-row justify-center items-center gap-3">
|
|
77
|
-
<
|
|
78
|
-
<CardTitle className="text-xl">
|
|
77
|
+
<AppWindow className="size-6 text-primary" />
|
|
78
|
+
<CardTitle className="text-xl">Custom Components</CardTitle>
|
|
79
79
|
</CardHeader>
|
|
80
80
|
<CardContent>
|
|
81
|
-
<p>
|
|
81
|
+
<p>Enhance your docs with custom components like Notes, Accordions, and Tabs.</p>
|
|
82
82
|
</CardContent>
|
|
83
83
|
</Card>
|
|
84
84
|
<Card className="px-2 py-6">
|
|
85
85
|
<CardHeader className="flex flex-row justify-center items-center gap-3">
|
|
86
|
-
<
|
|
87
|
-
<CardTitle className="text-xl">
|
|
86
|
+
<FileText className="size-6 text-primary" />
|
|
87
|
+
<CardTitle className="text-xl">Markdown Excellence</CardTitle>
|
|
88
88
|
</CardHeader>
|
|
89
89
|
<CardContent>
|
|
90
|
-
<p>
|
|
90
|
+
<p>Full support for GFM including tables, lists, and images for rich documentation.</p>
|
|
91
91
|
</CardContent>
|
|
92
92
|
</Card>
|
|
93
93
|
</div>
|
|
@@ -38,7 +38,7 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
38
38
|
<button
|
|
39
39
|
type="button"
|
|
40
40
|
onClick={() => setIsOpen(!isOpen)}
|
|
41
|
-
className="flex items-center gap-2 w-full px-4
|
|
41
|
+
className="flex items-center gap-2 w-full px-4 py-3 transition-colors bg-muted/40 dark:bg-muted/20 hover:bg-muted/70 dark:hover:bg-muted/70 cursor-pointer text-start"
|
|
42
42
|
>
|
|
43
43
|
<ChevronRight
|
|
44
44
|
className={cn(
|
|
@@ -47,7 +47,7 @@ const Accordion: React.FC<AccordionProps> = ({
|
|
|
47
47
|
)}
|
|
48
48
|
/>
|
|
49
49
|
{Icon && <Icon className="text-foreground w-4 h-4 flex-shrink-0" />}
|
|
50
|
-
<h3 className="font-medium text-base text-foreground !m-0
|
|
50
|
+
<h3 className="font-medium text-base text-foreground !m-0">{title}</h3>
|
|
51
51
|
</button>
|
|
52
52
|
|
|
53
53
|
{isOpen && (
|
|
@@ -6,10 +6,10 @@ const Table = React.forwardRef<
|
|
|
6
6
|
HTMLTableElement,
|
|
7
7
|
React.HTMLAttributes<HTMLTableElement>
|
|
8
8
|
>(({ className, ...props }, ref) => (
|
|
9
|
-
<div className="relative w-full overflow-auto">
|
|
9
|
+
<div className="relative w-full overflow-auto border border-border rounded-lg">
|
|
10
10
|
<table
|
|
11
11
|
ref={ref}
|
|
12
|
-
className={cn("w-full caption-bottom text-sm", className)}
|
|
12
|
+
className={cn("w-full caption-bottom text-sm !my-0", className)}
|
|
13
13
|
{...props}
|
|
14
14
|
/>
|
|
15
15
|
</div>
|
|
@@ -20,7 +20,7 @@ const TableHeader = React.forwardRef<
|
|
|
20
20
|
HTMLTableSectionElement,
|
|
21
21
|
React.HTMLAttributes<HTMLTableSectionElement>
|
|
22
22
|
>(({ className, ...props }, ref) => (
|
|
23
|
-
<thead ref={ref} className={cn("[&_tr]:border-b", className)} {...props} />
|
|
23
|
+
<thead ref={ref} className={cn("[&_tr]:border-b bg-muted", className)} {...props} />
|
|
24
24
|
))
|
|
25
25
|
TableHeader.displayName = "TableHeader"
|
|
26
26
|
|
|
@@ -19,6 +19,7 @@ example of ordered list format :
|
|
|
19
19
|
|
|
20
20
|
#### Heading 4
|
|
21
21
|
|
|
22
|
+
## Code Block
|
|
22
23
|
Below is an example of how to write a code block :
|
|
23
24
|
|
|
24
25
|
````plaintext
|
|
@@ -32,6 +33,18 @@ function isRocketAboutToCrash() {
|
|
|
32
33
|
```
|
|
33
34
|
````
|
|
34
35
|
|
|
36
|
+
<Accordion title="Code Block" defaultOpen={true} icon="Code">
|
|
37
|
+
```javascript:main.js showLineNumbers {3-4}
|
|
38
|
+
function isRocketAboutToCrash() {
|
|
39
|
+
// Check if the rocket is stable
|
|
40
|
+
if (!isStable()) {
|
|
41
|
+
NoCrash(); // Prevent the crash
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
</Accordion>
|
|
46
|
+
|
|
47
|
+
## Note
|
|
35
48
|
example note :
|
|
36
49
|
```plaintext
|
|
37
50
|
<Note type="note" title="Note">
|
|
@@ -39,6 +52,19 @@ example note :
|
|
|
39
52
|
</Note>
|
|
40
53
|
```
|
|
41
54
|
|
|
55
|
+
<Note type="warning" title="Warning">
|
|
56
|
+
every page that is indexed in a folder will have an `index.mdx` file with metadata :
|
|
57
|
+
```plaintext
|
|
58
|
+
---
|
|
59
|
+
title : Introduction
|
|
60
|
+
description : overview or synopsis of a project
|
|
61
|
+
date : 10-12-2024
|
|
62
|
+
image : example-img.png
|
|
63
|
+
---
|
|
64
|
+
```
|
|
65
|
+
</Note>
|
|
66
|
+
|
|
67
|
+
## Image
|
|
42
68
|
displaying an image in markdown format :
|
|
43
69
|
|
|
44
70
|
```plaintext
|
|
@@ -50,14 +76,17 @@ render as :
|
|
|
50
76
|
|
|
51
77
|
For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
## Table
|
|
80
|
+
|
|
81
|
+
### Default Table
|
|
82
|
+
|
|
83
|
+
| Property | Description | Type | Default |
|
|
84
|
+
| --- | --- | --- | --- |
|
|
85
|
+
| `title` | The title of the table | `string` | - |
|
|
86
|
+
| `description` | The description of the table | `string` | - |
|
|
87
|
+
|
|
88
|
+
### Table with Alignment
|
|
89
|
+
| Left | Center | Right |
|
|
90
|
+
| :--- | :---: | ---: |
|
|
91
|
+
| Left-aligned text | Center-aligned text | Right-aligned text |
|
|
92
|
+
| Left-aligned text | Center-aligned text | Right-aligned text |
|
|
@@ -19,6 +19,7 @@ example of ordered list format :
|
|
|
19
19
|
|
|
20
20
|
#### Heading 4
|
|
21
21
|
|
|
22
|
+
## Code Block
|
|
22
23
|
Below is an example of how to write a code block :
|
|
23
24
|
|
|
24
25
|
````plaintext
|
|
@@ -32,6 +33,18 @@ function isRocketAboutToCrash() {
|
|
|
32
33
|
```
|
|
33
34
|
````
|
|
34
35
|
|
|
36
|
+
<Accordion title="Code Block" defaultOpen={true} icon="Code">
|
|
37
|
+
```javascript:main.js showLineNumbers {3-4}
|
|
38
|
+
function isRocketAboutToCrash() {
|
|
39
|
+
// Check if the rocket is stable
|
|
40
|
+
if (!isStable()) {
|
|
41
|
+
NoCrash(); // Prevent the crash
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
</Accordion>
|
|
46
|
+
|
|
47
|
+
## Note
|
|
35
48
|
example note :
|
|
36
49
|
```plaintext
|
|
37
50
|
<Note type="note" title="Note">
|
|
@@ -39,17 +52,6 @@ example note :
|
|
|
39
52
|
</Note>
|
|
40
53
|
```
|
|
41
54
|
|
|
42
|
-
displaying an image in markdown format :
|
|
43
|
-
|
|
44
|
-
```plaintext
|
|
45
|
-

|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
render as :
|
|
49
|
-

|
|
50
|
-
|
|
51
|
-
For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
|
|
52
|
-
|
|
53
55
|
<Note type="warning" title="Warning">
|
|
54
56
|
every page that is indexed in a folder will have an `index.mdx` file with metadata :
|
|
55
57
|
```plaintext
|
|
@@ -62,13 +64,29 @@ image : example-img.png
|
|
|
62
64
|
```
|
|
63
65
|
</Note>
|
|
64
66
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
## Image
|
|
68
|
+
displaying an image in markdown format :
|
|
69
|
+
|
|
70
|
+
```plaintext
|
|
71
|
+

|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
render as :
|
|
75
|
+

|
|
76
|
+
|
|
77
|
+
For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
|
|
78
|
+
|
|
79
|
+
## Table
|
|
80
|
+
|
|
81
|
+
### Default Table
|
|
82
|
+
|
|
83
|
+
| Property | Description | Type | Default |
|
|
84
|
+
| --- | --- | --- | --- |
|
|
85
|
+
| `title` | The title of the table | `string` | - |
|
|
86
|
+
| `description` | The description of the table | `string` | - |
|
|
87
|
+
|
|
88
|
+
### Table with Alignment
|
|
89
|
+
| Left | Center | Right |
|
|
90
|
+
| :--- | :---: | ---: |
|
|
91
|
+
| Left-aligned text | Center-aligned text | Right-aligned text |
|
|
92
|
+
| Left-aligned text | Center-aligned text | Right-aligned text |
|
|
@@ -19,6 +19,7 @@ example of ordered list format :
|
|
|
19
19
|
|
|
20
20
|
#### Heading 4
|
|
21
21
|
|
|
22
|
+
## Code Block
|
|
22
23
|
Below is an example of how to write a code block :
|
|
23
24
|
|
|
24
25
|
````plaintext
|
|
@@ -32,6 +33,18 @@ function isRocketAboutToCrash() {
|
|
|
32
33
|
```
|
|
33
34
|
````
|
|
34
35
|
|
|
36
|
+
<Accordion title="Code Block" defaultOpen={true} icon="Code">
|
|
37
|
+
```javascript:main.js showLineNumbers {3-4}
|
|
38
|
+
function isRocketAboutToCrash() {
|
|
39
|
+
// Check if the rocket is stable
|
|
40
|
+
if (!isStable()) {
|
|
41
|
+
NoCrash(); // Prevent the crash
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
</Accordion>
|
|
46
|
+
|
|
47
|
+
## Note
|
|
35
48
|
example note :
|
|
36
49
|
```plaintext
|
|
37
50
|
<Note type="note" title="Note">
|
|
@@ -39,6 +52,19 @@ example note :
|
|
|
39
52
|
</Note>
|
|
40
53
|
```
|
|
41
54
|
|
|
55
|
+
<Note type="warning" title="Warning">
|
|
56
|
+
every page that is indexed in a folder will have an `index.mdx` file with metadata :
|
|
57
|
+
```plaintext
|
|
58
|
+
---
|
|
59
|
+
title : Introduction
|
|
60
|
+
description : overview or synopsis of a project
|
|
61
|
+
date : 10-12-2024
|
|
62
|
+
image : example-img.png
|
|
63
|
+
---
|
|
64
|
+
```
|
|
65
|
+
</Note>
|
|
66
|
+
|
|
67
|
+
## Image
|
|
42
68
|
displaying an image in markdown format :
|
|
43
69
|
|
|
44
70
|
```plaintext
|
|
@@ -50,14 +76,17 @@ render as :
|
|
|
50
76
|
|
|
51
77
|
For a complete guide on using markdown content in DocuBook, please refer to the [Components](https://docubook.pro/docs/components) page.
|
|
52
78
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
## Table
|
|
80
|
+
|
|
81
|
+
### Default Table
|
|
82
|
+
|
|
83
|
+
| Property | Description | Type | Default |
|
|
84
|
+
| --- | --- | --- | --- |
|
|
85
|
+
| `title` | The title of the table | `string` | - |
|
|
86
|
+
| `description` | The description of the table | `string` | - |
|
|
87
|
+
|
|
88
|
+
### Table with Alignment
|
|
89
|
+
| Left | Center | Right |
|
|
90
|
+
| :--- | :---: | ---: |
|
|
91
|
+
| Left-aligned text | Center-aligned text | Right-aligned text |
|
|
92
|
+
| Left-aligned text | Center-aligned text | Right-aligned text |
|
package/src/dist/lib/markdown.ts
CHANGED
|
@@ -31,6 +31,7 @@ interface TextNode extends Node {
|
|
|
31
31
|
|
|
32
32
|
// custom components imports
|
|
33
33
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
|
34
|
+
import { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell } from "@/components/ui/table";
|
|
34
35
|
import Pre from "@/components/markdown/PreMdx";
|
|
35
36
|
import Note from "@/components/markdown/NoteMdx";
|
|
36
37
|
import { Stepper, StepperItem } from "@/components/markdown/StepperMdx";
|
|
@@ -54,20 +55,22 @@ const components = {
|
|
|
54
55
|
TabsContent,
|
|
55
56
|
TabsList,
|
|
56
57
|
TabsTrigger,
|
|
57
|
-
pre: Pre,
|
|
58
|
-
Note,
|
|
59
|
-
Stepper,
|
|
60
|
-
StepperItem,
|
|
61
|
-
img: Image,
|
|
62
|
-
a: Link,
|
|
63
|
-
Outlet,
|
|
64
58
|
Youtube,
|
|
65
59
|
Tooltip,
|
|
66
60
|
Card,
|
|
67
61
|
Button,
|
|
68
62
|
Accordion,
|
|
63
|
+
AccordionGroup,
|
|
69
64
|
CardGroup,
|
|
70
65
|
Kbd,
|
|
66
|
+
// Table Components
|
|
67
|
+
table: Table,
|
|
68
|
+
thead: TableHeader,
|
|
69
|
+
tbody: TableBody,
|
|
70
|
+
tfoot: TableFooter,
|
|
71
|
+
tr: TableRow,
|
|
72
|
+
th: TableHead,
|
|
73
|
+
td: TableCell,
|
|
71
74
|
// Release Note Components
|
|
72
75
|
Release,
|
|
73
76
|
Changes,
|
|
@@ -75,7 +78,13 @@ const components = {
|
|
|
75
78
|
File,
|
|
76
79
|
Files,
|
|
77
80
|
Folder,
|
|
78
|
-
|
|
81
|
+
pre: Pre,
|
|
82
|
+
Note,
|
|
83
|
+
Stepper,
|
|
84
|
+
StepperItem,
|
|
85
|
+
img: Image,
|
|
86
|
+
a: Link,
|
|
87
|
+
Outlet,
|
|
79
88
|
};
|
|
80
89
|
|
|
81
90
|
// helper function to handle rehype code titles, since by default we can't inject into the className of rehype-code-titles
|
|
@@ -110,12 +119,12 @@ const handleCodeTitles = () => (tree: Node) => {
|
|
|
110
119
|
nextElement.properties = {};
|
|
111
120
|
}
|
|
112
121
|
nextElement.properties['data-title'] = titleNode.value;
|
|
113
|
-
|
|
122
|
+
|
|
114
123
|
// Remove the original title div
|
|
115
124
|
parent.children.splice(index, 1);
|
|
116
|
-
|
|
125
|
+
|
|
117
126
|
// Return the same index to continue visiting from the correct position
|
|
118
|
-
return index;
|
|
127
|
+
return index;
|
|
119
128
|
}
|
|
120
129
|
}
|
|
121
130
|
});
|
|
@@ -241,7 +250,7 @@ const preProcess = () => (tree: Node) => {
|
|
|
241
250
|
if (element?.type === "element" && element?.tagName === "pre" && element.children) {
|
|
242
251
|
const [codeEl] = element.children as Element[];
|
|
243
252
|
if (codeEl.tagName !== "code" || !codeEl.children?.[0]) return;
|
|
244
|
-
|
|
253
|
+
|
|
245
254
|
const textNode = codeEl.children[0] as TextNode;
|
|
246
255
|
if (textNode.type === 'text' && textNode.value) {
|
|
247
256
|
element.raw = textNode.value;
|