@docubook/create 2.3.0 → 2.4.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.
Files changed (53) hide show
  1. package/package.json +1 -1
  2. package/src/dist/app/docs/[[...slug]]/page.tsx +2 -5
  3. package/src/dist/app/layout.tsx +1 -3
  4. package/src/dist/app/page.tsx +2 -21
  5. package/src/dist/components/SearchModal.tsx +1 -1
  6. package/src/dist/components/context-popover.tsx +1 -1
  7. package/src/dist/components/docs-menu.tsx +2 -2
  8. package/src/dist/components/markdown/AccordionGroupMdx.tsx +1 -1
  9. package/src/dist/components/markdown/AccordionMdx.tsx +4 -4
  10. package/src/dist/components/markdown/CardMdx.tsx +4 -4
  11. package/src/dist/components/markdown/FileTreeMdx.tsx +4 -4
  12. package/src/dist/components/markdown/ImageMdx.tsx +1 -1
  13. package/src/dist/components/markdown/ReleaseMdx.tsx +1 -1
  14. package/src/dist/components/markdown/TooltipsMdx.tsx +1 -1
  15. package/src/dist/components/sublink.tsx +1 -1
  16. package/src/dist/docs/components/accordion-group.mdx +68 -0
  17. package/src/dist/docs/components/accordion.mdx +59 -0
  18. package/src/dist/docs/components/button.mdx +40 -0
  19. package/src/dist/docs/components/card-group.mdx +47 -0
  20. package/src/dist/docs/components/card.mdx +68 -0
  21. package/src/dist/docs/components/code-block.mdx +67 -0
  22. package/src/dist/docs/components/custom.mdx +38 -0
  23. package/src/dist/docs/components/file-tree.mdx +109 -0
  24. package/src/dist/docs/components/image.mdx +37 -0
  25. package/src/dist/docs/components/index.mdx +9 -0
  26. package/src/dist/docs/components/keyboard.mdx +117 -0
  27. package/src/dist/docs/components/link.mdx +34 -0
  28. package/src/dist/docs/components/note.mdx +44 -0
  29. package/src/dist/docs/components/release-note.mdx +114 -0
  30. package/src/dist/docs/components/stepper.mdx +45 -0
  31. package/src/dist/docs/components/tables.mdx +35 -0
  32. package/src/dist/docs/components/tabs.mdx +72 -0
  33. package/src/dist/docs/components/tooltips.mdx +22 -0
  34. package/src/dist/docs/components/youtube.mdx +23 -0
  35. package/src/dist/docs/getting-started/introduction.mdx +18 -0
  36. package/src/dist/docs/getting-started/quick-start-guide.mdx +60 -0
  37. package/src/dist/docu.json +36 -33
  38. package/src/dist/eslint.config.mjs +17 -30
  39. package/src/dist/lib/markdown.ts +32 -17
  40. package/src/dist/lib/utils.ts +1 -1
  41. package/src/dist/next.config.mjs +10 -11
  42. package/src/dist/package.json +1 -1
  43. package/src/dist/docs/api-reference/delete/index.mdx +0 -63
  44. package/src/dist/docs/api-reference/fetch/index.mdx +0 -63
  45. package/src/dist/docs/api-reference/get/index.mdx +0 -63
  46. package/src/dist/docs/api-reference/post/index.mdx +0 -63
  47. package/src/dist/docs/changelog/index.mdx +0 -49
  48. package/src/dist/docs/getting-started/development/index.mdx +0 -92
  49. package/src/dist/docs/getting-started/introduction/index.mdx +0 -92
  50. package/src/dist/docs/getting-started/quick-start-guide/index.mdx +0 -92
  51. /package/src/dist/components/{contexts/AccordionContext.ts → AccordionContext.ts} +0 -0
  52. /package/src/dist/components/{contexts/theme-provider.tsx → theme-provider.tsx} +0 -0
  53. /package/src/dist/lib/{routes-config.ts → routes.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docubook/create",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "CLI to create DocuBook projects",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -81,10 +81,7 @@ export default async function DocsPage(props: PageProps) {
81
81
  if (!res) notFound();
82
82
 
83
83
  const { title, description, image: _image, date } = res.frontmatter;
84
-
85
- // File path for edit link
86
- const filePath = `docs/${slug.join("/") || ""}/index.mdx`;
87
-
84
+ const filePath = res.filePath;
88
85
  const tocs = await getDocsTocs(pathName);
89
86
 
90
87
  return (
@@ -93,7 +90,7 @@ export default async function DocsPage(props: PageProps) {
93
90
  <MobToc tocs={tocs} />
94
91
  <DocsBreadcrumb paths={slug} />
95
92
  <Typography>
96
- <h1 className="text-3xl !-mt-0.5">{title}</h1>
93
+ <h1 className="text-3xl -mt-0.5!">{title}</h1>
97
94
  <p className="-mt-4 text-muted-foreground text-[16.5px]">{description}</p>
98
95
  <div>{res.content}</div>
99
96
  <div
@@ -1,11 +1,10 @@
1
1
  import type { Metadata } from "next";
2
- import { ThemeProvider } from "@/components/contexts/theme-provider";
2
+ import { ThemeProvider } from "@/components/theme-provider";
3
3
  import { Navbar } from "@/components/navbar";
4
4
  import { GeistSans } from "geist/font/sans";
5
5
  import { GeistMono } from "geist/font/mono";
6
6
  import { Footer } from "@/components/footer";
7
7
  import docuConfig from "@/docu.json";
8
- import { Toaster } from "@/components/ui/sonner";
9
8
  import "@docsearch/css";
10
9
  import "@/styles/algolia.css";
11
10
  import "@/styles/syntax.css";
@@ -91,7 +90,6 @@ export default function RootLayout({
91
90
  {children}
92
91
  </main>
93
92
  <Footer />
94
- <Toaster position="top-center" />
95
93
  </ThemeProvider>
96
94
  </body>
97
95
  </html>
@@ -1,9 +1,7 @@
1
1
  import { buttonVariants } from "@/components/ui/button";
2
- import { page_routes } from "@/lib/routes-config";
3
- import { ArrowRightIcon, Terminal, AppWindow, FileText } from "lucide-react";
2
+ import { page_routes } from "@/lib/routes";
3
+ import { Terminal, AppWindow, FileText } from "lucide-react";
4
4
  import Link from "next/link";
5
- import { cn } from "@/lib/utils";
6
- import AnimatedShinyText from "@/components/ui/animated-shiny-text";
7
5
  import { getMetadata } from "@/app/layout";
8
6
  import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
9
7
 
@@ -14,23 +12,6 @@ export const metadata = getMetadata({
14
12
  export default function Home() {
15
13
  return (
16
14
  <div className="flex flex-col items-center justify-center px-2 py-8 text-center sm:py-36">
17
- <Link
18
- href="/docs/changelog"
19
- className="mb-5 sm:text-lg flex items-center gap-2 underline underline-offset-4 sm:-mt-12"
20
- >
21
- <div className="z-10 flex min-h-10 items-center justify-center max-[800px]:mt-10">
22
- <div
23
- className={cn(
24
- "group rounded-full border border-black/5 bg-black/5 text-base text-white transition-all ease-in hover:cursor-pointer hover:bg-accent dark:border-white/5 dark:bg-transparent dark:hover:bg-accent",
25
- )}
26
- >
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.3.0</span>
29
- <ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
30
- </AnimatedShinyText>
31
- </div>
32
- </div>
33
- </Link>
34
15
  <div className="w-full max-w-[800px] pb-8">
35
16
  <h1 className="mb-4 text-2xl font-bold sm:text-5xl">DocuBook Starter Templates</h1>
36
17
  <p className="mb-8 sm:text-xl text-muted-foreground">
@@ -6,7 +6,7 @@ import { ArrowUpIcon, ArrowDownIcon, CornerDownLeftIcon, FileTextIcon } from "lu
6
6
  import Anchor from "./anchor";
7
7
  import { advanceSearch, cn } from "@/lib/utils";
8
8
  import { ScrollArea } from "@/components/ui/scroll-area";
9
- import { page_routes } from "@/lib/routes-config";
9
+ import { page_routes } from "@/lib/routes";
10
10
  import {
11
11
  DialogContent,
12
12
  DialogHeader,
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { usePathname, useRouter } from "next/navigation";
4
4
  import { useState, useEffect } from "react";
5
- import { ROUTES, EachRoute } from "@/lib/routes-config";
5
+ import { ROUTES, EachRoute } from "@/lib/routes";
6
6
  import { cn } from "@/lib/utils";
7
7
  import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
8
8
  import { Button } from "@/components/ui/button";
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
 
3
- import { ROUTES, EachRoute } from "@/lib/routes-config";
3
+ import { ROUTES, EachRoute } from "@/lib/routes";
4
4
  import SubLink from "./sublink";
5
5
  import { usePathname } from "next/navigation";
6
6
  import { cn } from "@/lib/utils";
@@ -15,7 +15,7 @@ function getCurrentContext(path: string): string | undefined {
15
15
  if (!path.startsWith('/docs')) return undefined;
16
16
 
17
17
  // Extract the first segment after /docs/
18
- const match = path.match(/^\/docs\/([^\/]+)/);
18
+ const match = path.match(/^\/docs\/([^/]+)/);
19
19
  return match ? match[1] : undefined;
20
20
  }
21
21
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  import React, { ReactNode } from "react";
4
4
  import clsx from "clsx";
5
- import { AccordionGroupContext } from "@/components/contexts/AccordionContext";
5
+ import { AccordionGroupContext } from "@/components/AccordionContext";
6
6
 
7
7
  interface AccordionGroupProps {
8
8
  children: ReactNode;
@@ -4,7 +4,7 @@ import { ReactNode, useState, useContext } from 'react';
4
4
  import { ChevronRight } from 'lucide-react';
5
5
  import * as Icons from "lucide-react";
6
6
  import { cn } from '@/lib/utils';
7
- import { AccordionGroupContext } from '@/components/contexts/AccordionContext';
7
+ import { AccordionGroupContext } from '@/components/AccordionContext';
8
8
 
9
9
  type AccordionProps = {
10
10
  title: string;
@@ -42,12 +42,12 @@ const Accordion: React.FC<AccordionProps> = ({
42
42
  >
43
43
  <ChevronRight
44
44
  className={cn(
45
- "w-4 h-4 text-muted-foreground transition-transform duration-200 flex-shrink-0",
45
+ "w-4 h-4 text-muted-foreground transition-transform duration-200 shrink-0",
46
46
  isOpen && "rotate-90"
47
47
  )}
48
48
  />
49
- {Icon && <Icon className="text-foreground w-4 h-4 flex-shrink-0" />}
50
- <h3 className="font-medium text-base text-foreground !m-0">{title}</h3>
49
+ {Icon && <Icon className="text-foreground w-4 h-4 shrink-0" />}
50
+ <h3 className="font-medium text-base text-foreground m-0!">{title}</h3>
51
51
  </button>
52
52
 
53
53
  {isOpen && (
@@ -24,13 +24,13 @@ const Card: React.FC<CardProps> = ({ title, icon, href, horizontal, children, cl
24
24
  "bg-card text-card-foreground border-border",
25
25
  "hover:bg-accent/5 hover:border-accent/30",
26
26
  "flex gap-2",
27
- horizontal ? "flex-row items-center gap-1" : "flex-col space-y-1",
27
+ horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
28
28
  className
29
29
  )}
30
30
  >
31
- {Icon && <Icon className="w-5 h-5 text-primary flex-shrink-0" />}
32
- <div className="flex-1 min-w-0 my-auto h-full">
33
- <span className="text-base font-semibold text-foreground">{title}</span>
31
+ {Icon && <Icon className={clsx("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5")} />}
32
+ <div className="flex-1 min-w-0">
33
+ <div className="text-base font-semibold text-foreground leading-6">{title}</div>
34
34
  <div className="text-sm text-muted-foreground -mt-3">{children}</div>
35
35
  </div>
36
36
  </div>
@@ -24,7 +24,7 @@ const FileComponent = ({ name }: FileProps) => {
24
24
  tabIndex={-1}
25
25
  >
26
26
  <FileIcon className={`
27
- h-3.5 w-3.5 flex-shrink-0 transition-colors
27
+ h-3.5 w-3.5 shrink-0 transition-colors
28
28
  ${isHovered ? 'text-accent' : 'text-muted-foreground'}
29
29
  `} />
30
30
  <span className="font-mono text-sm text-foreground truncate">{name}</span>
@@ -61,7 +61,7 @@ const FolderComponent = ({ name, children }: FileProps) => {
61
61
  {hasChildren ? (
62
62
  <ChevronRight
63
63
  className={`
64
- h-3.5 w-3.5 flex-shrink-0 transition-transform duration-200
64
+ h-3.5 w-3.5 shrink-0 transition-transform duration-200
65
65
  ${isOpen ? 'rotate-90' : ''}
66
66
  ${isHovered ? 'text-foreground/70' : 'text-muted-foreground'}
67
67
  `}
@@ -71,12 +71,12 @@ const FolderComponent = ({ name, children }: FileProps) => {
71
71
  )}
72
72
  {isOpen ? (
73
73
  <FolderOpen className={`
74
- h-4 w-4 flex-shrink-0 transition-colors
74
+ h-4 w-4 shrink-0 transition-colors
75
75
  ${isHovered ? 'text-accent' : 'text-muted-foreground'}
76
76
  `} />
77
77
  ) : (
78
78
  <FolderIcon className={`
79
- h-4 w-4 flex-shrink-0 transition-colors
79
+ h-4 w-4 shrink-0 transition-colors
80
80
  ${isHovered ? 'text-accent/80' : 'text-muted-foreground/80'}
81
81
  `} />
82
82
  )}
@@ -69,7 +69,7 @@ export default function Image({
69
69
  initial={{ opacity: 0 }}
70
70
  animate={{ opacity: 1 }}
71
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"
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
73
  onClick={() => setIsOpen(false)}
74
74
  >
75
75
  {/* Close Button */}
@@ -32,7 +32,7 @@ function Release({ version, title, date, children }: ReleaseProps) {
32
32
  </div>
33
33
  )}
34
34
  </div>
35
- <h3 className="text-2xl font-bold text-foreground/90 mb-6 !mt-0">
35
+ <h3 className="text-2xl font-bold text-foreground/90 mb-6 mt-0!">
36
36
  {title}
37
37
  </h3>
38
38
  <div className="space-y-8">
@@ -19,7 +19,7 @@ const Tooltip: React.FC<TooltipProps> = ({ text, tip }) => {
19
19
  {text}
20
20
  </span>
21
21
  {visible && (
22
- <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-3 w-64 bg-popover text-popover-foreground text-sm p-3 rounded-md shadow-lg border border-border/50 break-words text-left z-50">
22
+ <span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-3 w-64 bg-popover text-popover-foreground text-sm p-3 rounded-md shadow-lg border border-border/50 wrap-break-word text-left z-50">
23
23
  {tip}
24
24
  <span className="absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-popover rotate-45 border-b border-r border-border/50 -z-10" />
25
25
  </span>
@@ -1,4 +1,4 @@
1
- import { EachRoute } from "@/lib/routes-config";
1
+ import { EachRoute } from "@/lib/routes";
2
2
  import Anchor from "./anchor";
3
3
  import {
4
4
  Collapsible,
@@ -0,0 +1,68 @@
1
+ ---
2
+ title : Accordion Group
3
+ description: for writing multiple accordions and grouping them together
4
+ date : 10-08-2025
5
+ ---
6
+
7
+ An accordion is like a button that opens and closes information. To avoid clutter, long information can be hidden first and then revealed when clicked.
8
+
9
+ <Note type="note" title="Note">
10
+ Group related accordions together using `<AccordionGroup>`. This creates a cohesive section of accordions that can be individually expanded or collapsed.
11
+ </Note>
12
+
13
+ ## Usage
14
+
15
+ <AccordionGroup>
16
+ <Accordion title="Basic Usage">
17
+ example of using regular paragraph content inside the accordion component
18
+ </Accordion>
19
+
20
+ <Accordion title="With icon props" icon="MousePointerClick">
21
+ This accordion includes a [Lucide Icon](https://lucide.dev/icons/) because the `icon` prop is provided.
22
+ </Accordion>
23
+
24
+ <Accordion title="Expanded by Default" defaultOpen>
25
+ You can put other components inside Accordions.
26
+ ```jsx:helloword.jsx
27
+ class HelloWorld {
28
+ public static void main(String[] args) {
29
+ System.out.println("Hello, World!");
30
+ }
31
+ }
32
+ ```
33
+ </Accordion>
34
+ </AccordionGroup>
35
+
36
+ ## Writing Markdown
37
+
38
+ ````plaintext
39
+ <AccordionGroup>
40
+ <Accordion title="Basic Usage">
41
+ This accordion includes a [Lucide Icon](https://lucide.dev/icons/) because the `icon` prop is provided.
42
+ </Accordion>
43
+
44
+ <Accordion title="With icon props" icon="MousePointerClick">
45
+ This accordion includes a Lucide icon because the `icon` prop is provided.
46
+ </Accordion>
47
+
48
+ <Accordion title="Expanded by Default" defaultOpen>
49
+ You can put other components inside Accordions.
50
+ ```jsx:helloword.jsx
51
+ class HelloWorld {
52
+ public static void main(String[] args) {
53
+ System.out.println("Hello, World!");
54
+ }
55
+ }
56
+ ```
57
+ </Accordion>
58
+ </AccordionGroup>
59
+ ````
60
+
61
+ ## Props
62
+
63
+ | Prop | Type | Default | Description |
64
+ |------|------|---------|-------------|
65
+ | `title` | string | - | **Required**. The text displayed in the accordion header. |
66
+ | `children` | ReactNode | null | The content to be displayed when the accordion is expanded. Can be plain text, markdown, or React components. |
67
+ | `defaultOpen` | boolean | false | When true, the accordion will be expanded by default. |
68
+ | `icon` | string | undefined | Optional. Adds a Lucide icon before the title in the accordion header. |
@@ -0,0 +1,59 @@
1
+ ---
2
+ title: Accordion
3
+ description: A component used to create collapsible content that can be hidden and shown again.
4
+ date: 22-12-2024
5
+ ---
6
+
7
+ ## Preview
8
+
9
+ ### Basic Usage
10
+
11
+ ```plaintext
12
+ <Accordion title="Click to expand">
13
+ This is a simple accordion component that can be toggled by clicking the header. The content can include any valid React nodes, including text, components, and markdown.
14
+ </Accordion>
15
+ ```
16
+
17
+ Render as :
18
+
19
+ <Accordion title="Click to expand">
20
+ This is a simple accordion component that can be toggled by clicking the header. The content can include any valid React nodes, including text, components, and markdown.
21
+ </Accordion>
22
+
23
+ ### With Code Block
24
+
25
+ ````plaintext
26
+ <Accordion title="Code Block" defaultOpen={true} icon="Code">
27
+ ```javascript:main.js showLineNumbers {3-4}
28
+ function isRocketAboutToCrash() {
29
+ // Check if the rocket is stable
30
+ if (!isStable()) {
31
+ NoCrash(); // Prevent the crash
32
+ }
33
+ }
34
+ ```
35
+ </Accordion>
36
+ ````
37
+
38
+ Render as :
39
+
40
+ <Accordion title="Code Block" defaultOpen={true} icon="Code">
41
+ ```javascript:main.js showLineNumbers {3-4}
42
+ function isRocketAboutToCrash() {
43
+ // Check if the rocket is stable
44
+ if (!isStable()) {
45
+ NoCrash(); // Prevent the crash
46
+ }
47
+ }
48
+ ```
49
+ </Accordion>
50
+
51
+ ## Props
52
+
53
+ | Prop | Type | Default | Description |
54
+ |------|------|---------|-------------|
55
+ | `title` | string | - | **Required**. The text displayed in the accordion header. |
56
+ | `children` | ReactNode | null | The content to be displayed when the accordion is expanded. Can be plain text, markdown, or React components. |
57
+ | `defaultOpen` | boolean | false | When true, the accordion will be expanded by default. |
58
+ | `icon` | string | undefined | Optional. Adds a Lucide icon before the title in the accordion header. |
59
+
@@ -0,0 +1,40 @@
1
+ ---
2
+ title: Button
3
+ description: A component used to create buttons that can be used to trigger actions or navigate to other pages.
4
+ date: 14-12-2024
5
+ ---
6
+
7
+ ## Preview
8
+
9
+ <Button
10
+ text="Learn More"
11
+ href="https://learn.example.com"
12
+ icon="MoveUpRight"
13
+ size="md"
14
+ target="_blank"
15
+ variation="primary"
16
+ />
17
+
18
+ ## Props
19
+
20
+ | Prop | Type | Default | Description |
21
+ | ----------- | -------- | ----------- | -------------------------------------------- |
22
+ | `text` | string | undefined | The button text |
23
+ | `href` | string | **required**| The URL to navigate to |
24
+ | `icon` | string | undefined | Lucide icon name (e.g. "MoveUpRight") |
25
+ | `size` | string | "md" | Button size: `"sm"`, `"md"`, or `"lg"` |
26
+ | `target` | string | undefined | Link target (e.g. "_blank") |
27
+ | `variation` | string | "primary" | Button style: `"primary"`, `"accent"`, or `"outline"` |
28
+
29
+ ## Output Markdown
30
+
31
+ ```markdown
32
+ <Button
33
+ text="Learn More"
34
+ href="https://learn.example.com"
35
+ icon="MoveUpRight"
36
+ size="md"
37
+ target="_blank"
38
+ variation="primary"
39
+ />
40
+ ```
@@ -0,0 +1,47 @@
1
+ ---
2
+ title: Card Group
3
+ description: A component used to create card groups that can be used to display multiple cards in a compact and organized way.
4
+ date: 20-02-2025
5
+ ---
6
+
7
+ ## Preview
8
+
9
+ <CardGroup cols={2}>
10
+ <Card title="Heading 1" icon="Heading1">
11
+ This is an example of card content with columns.
12
+ </Card>
13
+ <Card title="Heading 2" icon="Heading2">
14
+ This is an example of card content with columns.
15
+ </Card>
16
+ <Card title="Grid Card" icon="Grid" horizontal>
17
+ This is a horizontal card layout.
18
+ </Card>
19
+ <Card title="Horizontal Card" icon="Layout" horizontal>
20
+ This is a horizontal card layout.
21
+ </Card>
22
+ </CardGroup>
23
+
24
+ ## Props
25
+
26
+ | Prop | Type | Default | Description |
27
+ | ------------- | -------- | ------- | ------------------------------------------------------- |
28
+ | `cols` | number | `{2}` | By default 2 The number of columns per row |
29
+
30
+ ## Output Markdown
31
+
32
+ ```markdown
33
+ <CardGroup cols={2}>
34
+ <Card title="Heading 1" icon="Heading1">
35
+ This is an example of card content with columns.
36
+ </Card>
37
+ <Card title="Heading 2" icon="Heading2">
38
+ This is an example of card content with columns.
39
+ </Card>
40
+ <Card title="Grid Card" icon="Grid" horizontal>
41
+ This is a horizontal card layout.
42
+ </Card>
43
+ <Card title="Horizontal Card" icon="Layout" horizontal>
44
+ This is a horizontal card layout.
45
+ </Card>
46
+ </CardGroup>
47
+ ```
@@ -0,0 +1,68 @@
1
+ ---
2
+ title: Cards
3
+ description: A component used to create cards that can be used to display content in a compact and organized way.
4
+ date: 20-02-2025
5
+ ---
6
+
7
+ ## Example
8
+
9
+ ### Card with Link and icon
10
+
11
+ <Card title="Click on me" icon="Link" href="/docs/components/card-group">
12
+ This is how you use a card with an icon and a link. Clicking on this card
13
+ brings you to the Card Group page.
14
+ </Card>
15
+
16
+ ### Card Horizontal
17
+
18
+ <Card title="Horizontal Card" icon="Layout" horizontal>
19
+ This is a horizontal card layout.
20
+ </Card>
21
+
22
+ ### Card Simple
23
+
24
+ <Card title="Simple Card">
25
+ This is a simple card without an icon or link.
26
+ </Card>
27
+
28
+
29
+ ## Props
30
+
31
+ | Prop | Type | Default | Description |
32
+ | ------------- | -------- | ------- | ------------------------------------------------------- |
33
+ | `title` | string | null | The value of card title. |
34
+ | `icon` | string | null | The value of card icon render from lucide. |
35
+ | `href` | string | null | The value of card link url. |
36
+ | `horizontal` | boolean | undefined | horizontal layout for card. |
37
+
38
+ ## Output Markdown
39
+
40
+ <Tabs defaultValue="link" className="pt-5 pb-1">
41
+ <TabsList>
42
+ <TabsTrigger value="link">Link & Icon</TabsTrigger>
43
+ <TabsTrigger value="horizontal">Horizontal</TabsTrigger>
44
+ <TabsTrigger value="simple">Simple</TabsTrigger>
45
+ </TabsList>
46
+ <TabsContent value="link">
47
+ ```markdown
48
+ <Card title="Click on me" icon="Link" href="/docs/getting-started/components/button">
49
+ This is how you use a card with an icon and a link. Clicking on this card
50
+ brings you to the Card Group page.
51
+ </Card>
52
+ ```
53
+ </TabsContent>
54
+ <TabsContent value="horizontal">
55
+ ```markdown
56
+ <Card title="Horizontal Card" icon="Layout" horizontal>
57
+ This is a horizontal card layout.
58
+ </Card>
59
+ ```
60
+ </TabsContent>
61
+ <TabsContent value="simple">
62
+ ```markdown
63
+ <Card title="Simple Card">
64
+ This is a simple card without an icon or link.
65
+ </Card>
66
+ ```
67
+ </TabsContent>
68
+ </Tabs>
@@ -0,0 +1,67 @@
1
+ ---
2
+ title: Code Block
3
+ description: A component used to display code snippets with optional line numbering and line highlighting.
4
+ date: 14-12-2024
5
+ ---
6
+
7
+ ## Preview
8
+
9
+ ```javascript:main.js showLineNumbers {3-4}
10
+ function isRocketAboutToCrash() {
11
+ // Check if the rocket is stable
12
+ if (!isStable()) {
13
+ NoCrash(); // Prevent the crash
14
+ }
15
+ }
16
+ ```
17
+
18
+ In this example, line numbers are displayed for lines 3 and 4. You can specify which lines to highlight using the format `{2,3-5}`.
19
+
20
+ ## Output Markdown
21
+
22
+ You can directly use the following syntax to create a code block with line numbers and highlight specific lines:
23
+
24
+ ````plaintext
25
+ ```javascript:main.js showLineNumbers {3-4}
26
+ function isRocketAboutToCrash() {
27
+ // Check if the rocket is stable
28
+ if (!isStable()) {
29
+ NoCrash(); // Prevent the crash
30
+ }
31
+ }
32
+ ```
33
+ ````
34
+
35
+ ## Features
36
+
37
+ - **Language Title**: You can use a title for each programming language to render an icon and display a title bar. For example : `javascript:index.js`
38
+ - **Line Numbers**: Enable line numbers by adding `showLineNumbers` after the opening backticks.
39
+ - **Highlight Lines**: Specify lines to highlight using curly braces (e.g., `{2,3-5}`).
40
+ - **Syntax Highlighting**: Use the appropriate language for syntax highlighting.
41
+
42
+ ## Language Support
43
+
44
+ | **Language** | **Title** |
45
+ | -------------------- | ------------------------ |
46
+ | **javascript** | `javascript:index.js` |
47
+ | **typescript** | `typescript:index.ts` |
48
+ | **jsx** or **tsx** | `jsx:index.jsx` |
49
+ | **python** | `python:main.py` |
50
+ | **go** | `go:main.go` |
51
+ | **php** | `php:index.php` |
52
+ | **ruby** | `ruby:main.rb` |
53
+ | **swift** | `swift:main.swift` |
54
+ | **kotlin** | `kotlin:main.kt` |
55
+ | **html** | `html:index.html` |
56
+ | **css** | `css:styles.css` |
57
+ | **sass** or **scss** | `sass:styles.sass` |
58
+ | **sql** | `sql:database.sql` |
59
+ | **graphql** | `graphql:database.gql` |
60
+ | **json** | `json:config.json` |
61
+ | **yaml** | `yaml:config.yml` |
62
+ | **toml** | `toml:config.toml` |
63
+ | **docker** | `docker:main.Dockerfile` |
64
+ | **nginx** | `nginx:config.nginx` |
65
+ | **gitignore** | `gitignore:.git` |
66
+ | **bash** | `bash:install.sh` |
67
+ | **markdown** | `markdown:readme.md` |
@@ -0,0 +1,38 @@
1
+ ---
2
+ title: Custom Components
3
+ description: How to create custom components for Markdown.
4
+ date: 14-12-2024
5
+ ---
6
+
7
+ To add custom components in DocuBook, follow these steps:
8
+
9
+ 1. **Create Your Component**: First, create your custom component in the `@components/markdown` folder. For example, you might create a file named `Outlet.tsx`.
10
+
11
+ 2. **Import Your Component**: Next, open the `@lib/markdown.ts` file. This is where you'll register your custom component for use in Markdown.
12
+
13
+ 3. **Add Your Component to the Components Object**: In the `@lib/markdown.ts` file, import your custom component and add it to the `components` object. Here’s how to do it:
14
+
15
+ ```ts
16
+ import Outlet from "@/components/markdown/outlet";
17
+
18
+ // Add custom components
19
+ const components = {
20
+ Outlet,
21
+ };
22
+ ```
23
+
24
+ 4. **Using Your Custom Component in Markdown**: After registering your component, you can now use it anywhere in your Markdown content. For instance, if your `Outlet` component is designed to display additional information, you can use it as follows:
25
+
26
+ ### Markdown Example
27
+
28
+ ```markdown
29
+ <Outlet>
30
+ This is some custom content rendered by the Outlet component!
31
+ </Outlet>
32
+ ```
33
+
34
+ ### Rendered Output
35
+
36
+ This will render the content inside the `Outlet` component, allowing you to create reusable and dynamic Markdown content.
37
+
38
+ By following these steps, you can extend the capabilities of your Markdown documentation and create a more engaging user experience.