@docubook/create 2.0.0-beta.2 → 2.0.0-beta.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/create",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "CLI to create DocuBook projects",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -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-beta.2</span>
28
+ <span>🚀 Release v2.0.0-beta.3</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>
@@ -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 h-12 transition-colors bg-muted/40 dark:bg-muted/20 hover:bg-muted/70 dark:hover:bg-muted/70 cursor-pointer"
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 leading-none">{title}</h3>
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
- <Note type="warning" title="Warning">
54
- every page that is indexed in a folder will have an `index.mdx` file with metadata :
55
- ```plaintext
56
- ---
57
- title : Introduction
58
- description : overview or synopsis of a project
59
- date : 10-12-2024
60
- image : example-img.png
61
- ---
62
- ```
63
- </Note>
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
- ![Alt text for the image](/images/example-img.png)
46
- ```
47
-
48
- render as :
49
- ![Alt text for the image](/images/example-img.png)
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
- <Accordion title="Code Block" defaultOpen={true} icon="Code">
66
- ```javascript:main.js showLineNumbers {3-4}
67
- function isRocketAboutToCrash() {
68
- // Check if the rocket is stable
69
- if (!isStable()) {
70
- NoCrash(); // Prevent the crash
71
- }
72
- }
73
- ```
74
- </Accordion>
67
+ ## Image
68
+ displaying an image in markdown format :
69
+
70
+ ```plaintext
71
+ ![Alt text for the image](/images/example-img.png)
72
+ ```
73
+
74
+ render as :
75
+ ![Alt text for the image](/images/example-img.png)
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
- <Note type="warning" title="Warning">
54
- every page that is indexed in a folder will have an `index.mdx` file with metadata :
55
- ```plaintext
56
- ---
57
- title : Introduction
58
- description : overview or synopsis of a project
59
- date : 10-12-2024
60
- image : example-img.png
61
- ---
62
- ```
63
- </Note>
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 |
@@ -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
- AccordionGroup
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;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docubook",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",