@docubook/create 2.0.0-beta.1 → 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.1",
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",
@@ -97,17 +97,16 @@ export default async function DocsPage(props: PageProps) {
97
97
  <p className="-mt-4 text-muted-foreground text-[16.5px]">{description}</p>
98
98
  <div>{res.content}</div>
99
99
  <div
100
- className={`my-8 flex items-center border-b-2 border-dashed border-x-muted-foreground ${
101
- docuConfig.repository?.editLink ? "justify-between" : "justify-end"
102
- }`}
103
- >
100
+ className={`my-8 flex items-center border-b-2 border-dashed border-x-muted-foreground ${docuConfig.repository?.editLink ? "justify-between" : "justify-end"
101
+ }`}
102
+ >
104
103
  {docuConfig.repository?.editLink && <EditThisPage filePath={filePath} />}
105
104
  {date && (
106
- <p className="text-[13px] text-muted-foreground">
105
+ <p className="text-[13px] text-muted-foreground">
107
106
  Published on {formatDate2(date)}
108
- </p>
107
+ </p>
109
108
  )}
110
- </div>
109
+ </div>
111
110
  <Pagination pathname={pathName} />
112
111
  </Typography>
113
112
  </div>
@@ -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.1</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>
@@ -96,7 +96,7 @@ export default function ContextPopover({ className }: ContextPopoverProps) {
96
96
  key={route.href}
97
97
  onClick={() => router.push(contextPath)}
98
98
  className={cn(
99
- "relative flex w-full items-center gap-2 rounded px-2 py-1.5 text-sm",
99
+ "relative flex w-full items-center gap-2 cursor-pointer rounded px-2 py-1.5 text-sm",
100
100
  "text-left outline-none transition-colors",
101
101
  isActive
102
102
  ? "bg-primary/20 text-primary dark:bg-accent/20 dark:text-accent"
@@ -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"
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 && (
@@ -19,7 +19,7 @@ export default function Copy({ content }: { content: string }) {
19
19
  return (
20
20
  <Button
21
21
  variant="secondary"
22
- className="border"
22
+ className="border cursor-copy"
23
23
  size="xs"
24
24
  onClick={handleCopy}
25
25
  >
@@ -1,29 +1,129 @@
1
- import { ComponentProps } from "react";
1
+ "use client";
2
+
3
+ import { ComponentProps, useState, useEffect } from "react";
2
4
  import NextImage from "next/image";
5
+ import { createPortal } from "react-dom";
6
+ import { motion, AnimatePresence } from "framer-motion";
7
+ import { X, ZoomIn } from "lucide-react";
3
8
 
4
9
  type Height = ComponentProps<typeof NextImage>["height"];
5
10
  type Width = ComponentProps<typeof NextImage>["width"];
6
11
 
7
12
  type ImageProps = Omit<ComponentProps<"img">, "src"> & {
8
- src?: ComponentProps<typeof NextImage>["src"];
13
+ src?: ComponentProps<typeof NextImage>["src"];
9
14
  };
10
15
 
11
16
  export default function Image({
12
- src,
13
- alt = "alt",
14
- width = 800,
15
- height = 350,
16
- ...props
17
+ src,
18
+ alt = "alt",
19
+ width = 800,
20
+ height = 350,
21
+ ...props
17
22
  }: ImageProps) {
18
- if (!src) return null;
19
- return (
20
- <NextImage
21
- src={src}
22
- alt={alt}
23
- width={width as Width}
24
- height={height as Height}
25
- quality={40}
26
- {...props}
27
- />
28
- );
23
+ const [isOpen, setIsOpen] = useState(false);
24
+
25
+ // Lock scroll when open
26
+ useEffect(() => {
27
+ if (isOpen) {
28
+ document.body.style.overflow = "hidden";
29
+ // Check for Escape key
30
+ const handleEsc = (e: KeyboardEvent) => {
31
+ if (e.key === "Escape") setIsOpen(false);
32
+ };
33
+ window.addEventListener("keydown", handleEsc);
34
+ return () => {
35
+ document.body.style.overflow = "auto";
36
+ window.removeEventListener("keydown", handleEsc);
37
+ };
38
+ }
39
+ }, [isOpen]);
40
+
41
+ if (!src) return null;
42
+
43
+ return (
44
+ <>
45
+ <button
46
+ type="button"
47
+ className="relative group cursor-zoom-in my-6 w-full flex justify-center rounded-lg"
48
+ onClick={() => setIsOpen(true)}
49
+ aria-label="Zoom image"
50
+ >
51
+ <span className="absolute inset-0 bg-black/0 group-hover:bg-black/5 transition-colors z-10 flex items-center justify-center opacity-0 group-hover:opacity-100 rounded-lg">
52
+ <ZoomIn className="w-8 h-8 text-white drop-shadow-md" />
53
+ </span>
54
+ <NextImage
55
+ src={src}
56
+ alt={alt}
57
+ width={width as Width}
58
+ height={height as Height}
59
+ quality={85}
60
+ className="w-full h-auto rounded-lg transition-transform duration-300 group-hover:scale-[1.01]"
61
+ {...props}
62
+ />
63
+ </button>
64
+
65
+ <AnimatePresence>
66
+ {isOpen && (
67
+ <Portal>
68
+ <motion.div
69
+ initial={{ opacity: 0 }}
70
+ animate={{ opacity: 1 }}
71
+ exit={{ opacity: 0 }}
72
+ className="fixed inset-0 z-[99999] flex items-center justify-center bg-black/90 backdrop-blur-md p-4 md:p-10 cursor-zoom-out"
73
+ onClick={() => setIsOpen(false)}
74
+ >
75
+ {/* Close Button */}
76
+ <button
77
+ className="absolute top-4 right-4 z-50 p-2 text-white/70 hover:text-white bg-black/20 hover:bg-white/10 rounded-full transition-colors"
78
+ onClick={(e) => {
79
+ e.stopPropagation();
80
+ setIsOpen(false);
81
+ }}
82
+ >
83
+ <X className="w-6 h-6" />
84
+ </button>
85
+
86
+ {/* Image Container */}
87
+ <motion.div
88
+ initial={{ scale: 0.9, opacity: 0 }}
89
+ animate={{ scale: 1, opacity: 1 }}
90
+ exit={{ scale: 0.9, opacity: 0 }}
91
+ transition={{ type: "spring", damping: 25, stiffness: 300 }}
92
+ className="relative max-w-7xl w-full h-full flex items-center justify-center"
93
+ onClick={(e) => e.stopPropagation()}
94
+ >
95
+ <div className="relative w-full h-full flex items-center justify-center" onClick={() => setIsOpen(false)}>
96
+ <NextImage
97
+ src={src}
98
+ alt={alt}
99
+ width={1920}
100
+ height={1080}
101
+ className="object-contain max-h-[90vh] w-auto h-auto rounded-md shadow-2xl"
102
+ quality={95}
103
+ />
104
+ </div>
105
+ </motion.div>
106
+
107
+ {/* Caption */}
108
+ {alt && alt !== "alt" && (
109
+ <motion.div
110
+ initial={{ y: 20, opacity: 0 }}
111
+ animate={{ y: 0, opacity: 1 }}
112
+ className="absolute bottom-6 left-1/2 -translate-x-1/2 bg-black/60 text-white px-4 py-2 rounded-full text-sm font-medium backdrop-blur-md border border-white/10"
113
+ >
114
+ {alt}
115
+ </motion.div>
116
+ )}
117
+
118
+ </motion.div>
119
+ </Portal>
120
+ )}
121
+ </AnimatePresence>
122
+ </>
123
+ );
29
124
  }
125
+
126
+ const Portal = ({ children }: { children: React.ReactNode }) => {
127
+ if (typeof window === "undefined") return null;
128
+ return createPortal(children, document.body);
129
+ };
@@ -1,52 +1,69 @@
1
+ "use client";
2
+
1
3
  import { cn } from "@/lib/utils";
2
- import clsx from "clsx";
3
- import { PropsWithChildren } from "react";
4
+ import { cva, type VariantProps } from "class-variance-authority";
4
5
  import {
5
6
  Info,
6
7
  AlertTriangle,
7
8
  ShieldAlert,
8
- CheckCircle,
9
+ CheckCircle2,
9
10
  } from "lucide-react";
11
+ import React from "react";
10
12
 
11
- type NoteProps = PropsWithChildren & {
12
- title?: string;
13
- type?: "note" | "danger" | "warning" | "success";
14
- };
13
+ const noteVariants = cva(
14
+ "relative w-full rounded-lg border border-l-4 p-4 mb-4 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
15
+ {
16
+ variants: {
17
+ variant: {
18
+ note: "bg-muted/30 border-border border-l-primary/50 text-foreground [&>svg]:text-primary",
19
+ danger: "border-destructive/20 border-l-destructive/60 bg-destructive/5 text-destructive [&>svg]:text-destructive dark:border-destructive/30",
20
+ warning: "border-orange-500/20 border-l-orange-500/60 bg-orange-500/5 text-orange-600 dark:text-orange-400 [&>svg]:text-orange-600 dark:[&>svg]:text-orange-400",
21
+ success: "border-emerald-500/20 border-l-emerald-500/60 bg-emerald-500/5 text-emerald-600 dark:text-emerald-400 [&>svg]:text-emerald-600 dark:[&>svg]:text-emerald-400",
22
+ },
23
+ },
24
+ defaultVariants: {
25
+ variant: "note",
26
+ },
27
+ }
28
+ );
15
29
 
16
30
  const iconMap = {
17
- note: <Info size={16} className="text-blue-500" />,
18
- danger: <ShieldAlert size={16} className="text-red-500" />,
19
- warning: <AlertTriangle size={16} className="text-orange-500" />,
20
- success: <CheckCircle size={16} className="text-green-500" />,
31
+ note: Info,
32
+ danger: ShieldAlert,
33
+ warning: AlertTriangle,
34
+ success: CheckCircle2,
21
35
  };
22
36
 
37
+ interface NoteProps
38
+ extends React.HTMLAttributes<HTMLDivElement>,
39
+ VariantProps<typeof noteVariants> {
40
+ title?: string;
41
+ type?: "note" | "danger" | "warning" | "success";
42
+ }
43
+
23
44
  export default function Note({
24
- children,
45
+ className,
25
46
  title = "Note",
26
47
  type = "note",
48
+ children,
49
+ ...props
27
50
  }: NoteProps) {
28
- const noteClassNames = clsx({
29
- "dark:bg-stone-950/25 bg-stone-50": type === "note",
30
- "dark:bg-red-950 bg-red-100 border-red-200 dark:border-red-900":
31
- type === "danger",
32
- "bg-orange-50 border-orange-200 dark:border-orange-900 dark:bg-orange-900/50":
33
- type === "warning",
34
- "dark:bg-green-950 bg-green-100 border-green-200 dark:border-green-900":
35
- type === "success",
36
- });
51
+ const Icon = iconMap[type] || Info;
37
52
 
38
53
  return (
39
54
  <div
40
- className={cn(
41
- "border rounded-md px-5 pb-0.5 mt-5 mb-7 text-sm tracking-wide",
42
- noteClassNames
43
- )}
55
+ className={cn(noteVariants({ variant: type }), className)}
56
+ {...props}
44
57
  >
45
- <div className="flex items-center gap-2 font-bold -mb-2.5 pt-6">
46
- {iconMap[type]}
47
- <span className="text-base">{title}:</span>
58
+ <Icon className="h-5 w-5" />
59
+ <div className="pl-8">
60
+ <h5 className="mb-1 font-medium leading-none tracking-tight">
61
+ {title}
62
+ </h5>
63
+ <div className="text-sm [&_p]:leading-relaxed opacity-90">
64
+ {children}
65
+ </div>
48
66
  </div>
49
- {children}
50
67
  </div>
51
68
  );
52
69
  }
@@ -86,7 +86,7 @@ export default function SubLink({
86
86
  <div className={cn("flex flex-col gap-1 w-full")}>
87
87
  <Collapsible open={isOpen} onOpenChange={setIsOpen}>
88
88
  <CollapsibleTrigger
89
- className="w-full pr-5 text-left"
89
+ className="w-full pr-5 text-left cursor-pointer"
90
90
  aria-expanded={isOpen}
91
91
  aria-controls={`collapsible-${fullHref.replace(/[^a-zA-Z0-9]/g, '-')}`}
92
92
  >
@@ -49,7 +49,7 @@ export function ModeToggle() {
49
49
  value="light"
50
50
  size="sm"
51
51
  aria-label="Light Mode"
52
- className={`rounded-full p-1 transition-all ${activeTheme === "light"
52
+ className={`rounded-full cursor-pointer p-1 transition-all ${activeTheme === "light"
53
53
  ? "bg-primary text-primary-foreground"
54
54
  : "bg-transparent hover:bg-muted/50"
55
55
  }`}
@@ -60,7 +60,7 @@ export function ModeToggle() {
60
60
  value="dark"
61
61
  size="sm"
62
62
  aria-label="Dark Mode"
63
- className={`rounded-full p-1 transition-all ${activeTheme === "dark"
63
+ className={`rounded-full cursor-pointer p-1 transition-all ${activeTheme === "dark"
64
64
  ? "bg-primary text-primary-foreground"
65
65
  : "bg-transparent hover:bg-muted/50"
66
66
  }`}
@@ -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
 
@@ -29,7 +29,7 @@ const TabsTrigger = React.forwardRef<
29
29
  <TabsPrimitive.Trigger
30
30
  ref={ref}
31
31
  className={cn(
32
- "inline-flex items-center justify-center whitespace-nowrap px-1.5 py-[0.58rem] text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-primary border-b-2 border-transparent data-[state=active]:text-foreground font-code",
32
+ "inline-flex items-center justify-center whitespace-nowrap px-1.5 py-[0.58rem] text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-primary border-b-2 border-transparent data-[state=active]:text-foreground font-code cursor-pointer",
33
33
  className
34
34
  )}
35
35
  {...props}
@@ -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.1",
3
+ "version": "2.0.0-beta.3",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",
@@ -31,7 +31,7 @@
31
31
  "geist": "^1.5.1",
32
32
  "gray-matter": "^4.0.3",
33
33
  "lucide-react": "^0.511.0",
34
- "next": "16.1.3",
34
+ "next": "^16.1.6",
35
35
  "next-mdx-remote": "^5.0.0",
36
36
  "next-themes": "^0.4.4",
37
37
  "react": "19.2.3",