From a071f0cc75700ccc1e5646c557f3650a17005e82 Mon Sep 17 00:00:00 2001
From: Baptiste Parmantier
Date: Fri, 12 Dec 2025 09:14:09 +0100
Subject: [PATCH 1/3] wip
---
astro.config.mjs | 21 +-
.../foundamentals/components/card.mdx | 69 +++---
.../foundamentals/components/code-block.mdx | 40 ++--
.../foundamentals/components/markdown.mdx | 22 +-
content/index.mdx | 7 +-
explainer.config.ts | 11 +
src/assets/css/markdown.css | 20 +-
.../content/code-group/code-group.astro | 13 ++
.../content/code-group/code-group.tsx | 202 ++++++++++++++++++
.../plugins/code-group/CodeGroupWrapper.astro | 21 --
.../code-group/code-group-component.tsx | 91 --------
src/lib/plugins/code-group/plugin.ts | 151 -------------
src/lib/plugins/parser/block-renderer.astro | 68 ------
src/lib/plugins/parser/dynamic-block.astro | 23 --
src/lib/plugins/parser/plugin.ts | 126 +----------
src/lib/plugins/parser/selectors.ts | 25 ---
src/lib/plugins/read-more/remark-directive.ts | 18 +-
.../plugins/shiki/transformer-meta-label.ts | 27 +++
src/lib/utils.ts | 5 +
src/pages/docs/[...slug].astro | 16 +-
20 files changed, 360 insertions(+), 616 deletions(-)
create mode 100644 src/lib/components/content/code-group/code-group.astro
create mode 100644 src/lib/components/content/code-group/code-group.tsx
delete mode 100644 src/lib/plugins/code-group/CodeGroupWrapper.astro
delete mode 100644 src/lib/plugins/code-group/code-group-component.tsx
delete mode 100644 src/lib/plugins/code-group/plugin.ts
delete mode 100644 src/lib/plugins/parser/block-renderer.astro
delete mode 100644 src/lib/plugins/parser/dynamic-block.astro
delete mode 100644 src/lib/plugins/parser/selectors.ts
create mode 100644 src/lib/plugins/shiki/transformer-meta-label.ts
diff --git a/astro.config.mjs b/astro.config.mjs
index dc48169..3c1ee64 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -15,16 +15,13 @@ import tailwindcss from "@tailwindcss/vite";
import icon from "astro-icon";
import rehypeCallouts from "rehype-callouts";
import rehypeMermaid from "rehype-mermaid";
-import rehypeCodeGroupReact from "./src/lib/plugins/code-group/plugin";
-import rehypeReadMoreReact from "./src/lib/plugins/read-more/plugin";
import rehypeBlogListReact from "./src/lib/plugins/blog-list/plugin";
-import rehypeBlock from "./src/lib/plugins/parser/plugin";
-import {
- default as remarkDirective,
- default as remarkReadMoreDirective,
-} from "./src/lib/plugins/read-more/remark-directive";
+import remarkBlockParser from "./src/lib/plugins/parser/plugin";
+import remarkDirectivePkg from "remark-directive";
+import remarkReadMoreDirective from "./src/lib/plugins/read-more/remark-directive";
import sitemap from "@astrojs/sitemap";
import { buildDocIntegration } from "./src/hooks/build-doc";
+import transformerMetaLabel from "./src/lib/plugins/shiki/transformer-meta-label";
export default defineConfig({
site: "https://example.com",
@@ -45,15 +42,19 @@ export default defineConfig({
transformerNotationFocus(),
transformerNotationErrorLevel(),
transformerMetaHighlight(),
+ transformerMetaLabel(),
],
},
syntaxHighlight: {
type: "shiki",
excludeLangs: ["mermaid"],
},
- remarkPlugins: [remarkDirective, remarkReadMoreDirective],
+ remarkPlugins: [
+ remarkDirectivePkg,
+ remarkBlockParser,
+ remarkReadMoreDirective,
+ ],
rehypePlugins: [
- rehypeBlock,
rehypeMermaid,
[
rehypeCallouts,
@@ -65,8 +66,6 @@ export default defineConfig({
},
},
],
- rehypeCodeGroupReact,
- rehypeReadMoreReact,
rehypeBlogListReact,
],
},
diff --git a/content/docs/documentation/foundamentals/components/card.mdx b/content/docs/documentation/foundamentals/components/card.mdx
index 1ad7601..88ead59 100644
--- a/content/docs/documentation/foundamentals/components/card.mdx
+++ b/content/docs/documentation/foundamentals/components/card.mdx
@@ -10,26 +10,27 @@ icon: lucide:grid-2x2
This component allows you to group text elements while providing visual impact.
```
-:::card-group
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
```
-:::card-group {cols=2}
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group{cols=2}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
---
@@ -43,57 +44,57 @@ You can customize the number of elements per line by setting the `cols` prop.
> Default card per line was fixed to 2
```
-:::card-group {cols=4}
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group{cols=4}
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
```
-:::card-group {cols=4}
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group{cols=4}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
If the elements cannot be aligned horizontally, they will be moved to the next line.
```
-:::card-group {cols=2}
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group{cols=2}
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
```
-:::card-group {cols=2}
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group{cols=2}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
### Card item
@@ -106,23 +107,23 @@ Vous pouvez personaliser chacune de vos cartes en utilisant les props suivantes
> The cards use the [`iconify`](https://icon-sets.iconify.design/) library to display icons.
```
-:::card-group
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
- :::card {label="Lorem ipsum dolor sit amet", icon="lucide:user"}
+ :::card{label="Lorem ipsum dolor sit amet" icon="lucide:user"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
```
-:::card-group {cols=2}
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:bell"}
+::::card-group{cols=2}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:bell"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::card {label="Lorem ipsum dolor sit amet", icon="lucide:user"}
+:::card{label="Lorem ipsum dolor sit amet" icon="lucide:user"}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
:::
-:::
+::::
diff --git a/content/docs/documentation/foundamentals/components/code-block.mdx b/content/docs/documentation/foundamentals/components/code-block.mdx
index 29e315f..7ae81bd 100644
--- a/content/docs/documentation/foundamentals/components/code-block.mdx
+++ b/content/docs/documentation/foundamentals/components/code-block.mdx
@@ -110,39 +110,44 @@ impl User {
## Group code blocks
-Group code blocks can be done with the `:::codegroup labels=[...labels]` syntax.
-
> [!warning] This is a **collapsible** callout
> Only code blocks can be used in a group.
-:::codegroup labels=[Without labels, With labels]
+:::codegroup
-```
-:::codegroup auto
-// Code block without labels
-:::
+```rs [foo]
+pub struct User {
+ pub firstname: String,
+ pub lastname: String,
+}
```
-```
-:::codegroup labels=[first,, third]
-// First code block (named)
-// Second code block
-// Third code block (named)
-:::
+```rs [bar]
+pub struct User {
+ pub firstname: String,
+ pub lastname: String,
+}
+
+impl User {
+ pub fn new(firstname: String, lastname: String) -> Self {
+ Self { firstname, lastname }
+ }
+}
```
:::
-:::codegroup labels=[struct, impl]
+````md
+:::codegroup
-```rust
+```rs [foo]
pub struct User {
- pub firstname: String, // [!code highlight]
+ pub firstname: String,
pub lastname: String,
}
```
-```rust
+```rs [bar]
pub struct User {
pub firstname: String,
pub lastname: String,
@@ -156,3 +161,4 @@ impl User {
```
:::
+````
diff --git a/content/docs/documentation/foundamentals/components/markdown.mdx b/content/docs/documentation/foundamentals/components/markdown.mdx
index 8506538..bc1126c 100644
--- a/content/docs/documentation/foundamentals/components/markdown.mdx
+++ b/content/docs/documentation/foundamentals/components/markdown.mdx
@@ -13,15 +13,15 @@ Markdown is a lightweight markup language that you can use to add formatting ele
You can create ordered and unordered lists:
-:::codegroup labels=[Ordered, Unordered]
+:::codegroup
-```mdx
+```mdx [ordered]
1. First item
2. Second item
3. Third item
```
-```mdx
+```mdx [unordered]
- First item
- Second item
- Third item
@@ -73,19 +73,3 @@ You can create tables using the `|` syntax:
| -------- | -------- | -------- |
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
-
-## Read More
-
-You can add a read more link using the `:read-more` syntax:
-
-:::codegroup labels=[Base, With title]
-
-```mdx
-dd
-```
-
-```mdx
-ff
-```
-
-:::
diff --git a/content/index.mdx b/content/index.mdx
index 2615bc1..a202a54 100644
--- a/content/index.mdx
+++ b/content/index.mdx
@@ -150,12 +150,9 @@ import { Badge } from "@/components/ui/badge";
Follow our blog for updates and news
- Learn more about our latest developments.
- We share tips and tricks to help you succeed.og posts and follow us
+ Learn more about our latest developments. We share tips and tricks to
+ help you succeed.og posts and follow us
+
+
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 7319793..21fe35e 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -42,6 +42,7 @@ type ExplainerConfig = {
href: string;
}[];
content: {
+ icons: Record;
components: {
[key: string]: (...props: any[]) => any;
};
From 0c9d79334ff0ec9364c605541e04561e1c77b2c9 Mon Sep 17 00:00:00 2001
From: Baptiste Parmantier
Date: Fri, 12 Dec 2025 23:38:46 +0100
Subject: [PATCH 3/3] feat: implement callout
---
astro.config.mjs | 7 +-
.../foundamentals/components/_default.mdx | 1 +
.../foundamentals/components/alert.mdx | 62 ------------
.../foundamentals/components/callout.mdx | 96 +++++++++++++++++++
.../foundamentals/components/code-block.mdx | 18 ++++
.../foundamentals/components/markdown.mdx | 17 +---
.../foundamentals/components/text.mdx | 16 +++-
.../docs/documentation/foundamentals/docs.mdx | 18 ++--
.../documentation/foundamentals/routing.mdx | 22 +++--
.../getting-started/configuration.mdx | 2 +-
.../documentation/getting-started/deploy.mdx | 10 +-
.../getting-started/getting-started.mdx | 3 -
.../getting-started/project-structure.mdx | 12 ++-
explainer.config.ts | 2 +
src/lib/components/content/callout.astro | 81 ++++++++++++++++
src/lib/components/content/codeblock.astro | 1 -
.../plugins/read-more/ReadMoreWrapper.astro | 5 -
src/lib/plugins/read-more/plugin.ts | 24 -----
.../plugins/read-more/read-more-component.tsx | 42 --------
src/lib/plugins/read-more/remark-directive.ts | 28 ------
20 files changed, 252 insertions(+), 215 deletions(-)
delete mode 100644 content/docs/documentation/foundamentals/components/alert.mdx
create mode 100644 content/docs/documentation/foundamentals/components/callout.mdx
create mode 100644 src/lib/components/content/callout.astro
delete mode 100644 src/lib/plugins/read-more/ReadMoreWrapper.astro
delete mode 100644 src/lib/plugins/read-more/plugin.ts
delete mode 100644 src/lib/plugins/read-more/read-more-component.tsx
delete mode 100644 src/lib/plugins/read-more/remark-directive.ts
diff --git a/astro.config.mjs b/astro.config.mjs
index 3c1ee64..54c9134 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -18,7 +18,6 @@ import rehypeMermaid from "rehype-mermaid";
import rehypeBlogListReact from "./src/lib/plugins/blog-list/plugin";
import remarkBlockParser from "./src/lib/plugins/parser/plugin";
import remarkDirectivePkg from "remark-directive";
-import remarkReadMoreDirective from "./src/lib/plugins/read-more/remark-directive";
import sitemap from "@astrojs/sitemap";
import { buildDocIntegration } from "./src/hooks/build-doc";
import transformerMetaLabel from "./src/lib/plugins/shiki/transformer-meta-label";
@@ -49,11 +48,7 @@ export default defineConfig({
type: "shiki",
excludeLangs: ["mermaid"],
},
- remarkPlugins: [
- remarkDirectivePkg,
- remarkBlockParser,
- remarkReadMoreDirective,
- ],
+ remarkPlugins: [remarkDirectivePkg, remarkBlockParser],
rehypePlugins: [
rehypeMermaid,
[
diff --git a/content/docs/documentation/foundamentals/components/_default.mdx b/content/docs/documentation/foundamentals/components/_default.mdx
index ef423f2..cdbe2ca 100644
--- a/content/docs/documentation/foundamentals/components/_default.mdx
+++ b/content/docs/documentation/foundamentals/components/_default.mdx
@@ -10,4 +10,5 @@ collection:
- markdown
- text
- card
+ - callout
---
diff --git a/content/docs/documentation/foundamentals/components/alert.mdx b/content/docs/documentation/foundamentals/components/alert.mdx
deleted file mode 100644
index f17a672..0000000
--- a/content/docs/documentation/foundamentals/components/alert.mdx
+++ /dev/null
@@ -1,62 +0,0 @@
----
-title: Alert
-description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
-permalink: alert
-icon: lucide:bell
----
-
-# Alert
-
-Alerts are UI components that help highlight important information to users. They can be used to provide feedback, warnings, errors, or general notes.
-
-In Explainer, alerts can be created using a simple Markdown syntax and can be either expanded by default or collapsible. Different types of alerts (`success`, `warning`, `note`, `error`) are available to convey different levels of importance or urgency.
-
-## Success
-
-```
-> [!success]
-> Some content is displayed directly!
-```
-
-> [!success]
-> Some content is displayed directly!
-
-## Warning
-
-```
-> [!warning] This is a **collapsible** callout
-> Some content shown after opening!
-```
-
-> [!warning] This is a **collapsible** callout
-> Some content shown after opening!
-
-## Note
-
-```
-> [!note] This is a **collapsible** callout
-> Some content shown after opening!
-```
-
-> [!note] This is a **collapsible** callout
-> Some content shown after opening!
-
-## Error
-
-```
-> [!error] This is a **collapsible** callout
-> Some content shown after opening!
-```
-
-> [!error] This is a **collapsible** callout
-> Some content shown after opening!
-
-## Important
-
-```
-> [!important] This is a **collapsible** callout
-> Some content shown after opening!
-```
-
-> [!important] This is a **collapsible** callout
-> Some content shown after opening!
diff --git a/content/docs/documentation/foundamentals/components/callout.mdx b/content/docs/documentation/foundamentals/components/callout.mdx
new file mode 100644
index 0000000..390b139
--- /dev/null
+++ b/content/docs/documentation/foundamentals/components/callout.mdx
@@ -0,0 +1,96 @@
+---
+title: Callout
+description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+permalink: callout
+icon: lucide:tag
+---
+
+# Callouts
+
+## Basic callouts
+
+### Info
+
+:::callout{variant="info"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+
+```
+:::callout{variant="info"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+```
+
+---
+
+### Success
+
+:::callout{variant="success"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+
+```
+:::callout{variant="success"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+```
+
+---
+
+### Warning
+
+:::callout{variant="warning"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+
+```
+:::callout{variant="warning"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+```
+
+---
+
+### Danger
+
+:::callout{variant="danger"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+
+```
+:::callout{variant="danger"}
+Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+:::
+```
+
+---
+
+## Children
+
+:::callout
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+```rs [main.rs]
+pub fn main() {
+ println!("Hello, world!");
+}
+```
+
+:::
+
+````
+:::callout
+Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+
+```rs [main.rs]
+pub fn main() {
+ println!("Hello, world!");
+}
+```
+
+:::
+````
diff --git a/content/docs/documentation/foundamentals/components/code-block.mdx b/content/docs/documentation/foundamentals/components/code-block.mdx
index 7ae81bd..48a8d8c 100644
--- a/content/docs/documentation/foundamentals/components/code-block.mdx
+++ b/content/docs/documentation/foundamentals/components/code-block.mdx
@@ -86,6 +86,24 @@ pub struct User {
}
```
+## Include embedded code blocks
+
+```rs [entities/user.rs]
+pub struct User {
+ pub firstname: String,
+ pub lastname: String,
+}
+```
+
+````
+```rs [entities/user.rs]
+pub struct User {
+ pub firstname: String,
+ pub lastname: String,
+}
+```
+````
+
---
## Line modifiers
diff --git a/content/docs/documentation/foundamentals/components/markdown.mdx b/content/docs/documentation/foundamentals/components/markdown.mdx
index bc1126c..82dbfba 100644
--- a/content/docs/documentation/foundamentals/components/markdown.mdx
+++ b/content/docs/documentation/foundamentals/components/markdown.mdx
@@ -33,7 +33,7 @@ You can create ordered and unordered lists:
You can create links using the `[text](url)` syntax:
-```mdx
+```mdx [Simple link]
[Google](https://www.google.com)
```
@@ -41,28 +41,19 @@ You can create links using the `[text](url)` syntax:
You can add images using the `` syntax:
-```mdx
+```mdx [Simple image]

```

-## Code Blocks
-
-You can add code blocks using the ``` syntax:
-
-```dart
-print("Hello, World!")
-```
-
-> [!NOTE]
-> See more about [code blocks](/docs/syntax/code-blocks)
+---
## Tables
You can create tables using the `|` syntax:
-```mdx
+```mdx [Simple table]
| Header 1 | Header 2 | Header 3 |
| -------- | -------- | -------- |
| Cell 1 | Cell 2 | Cell 3 |
diff --git a/content/docs/documentation/foundamentals/components/text.mdx b/content/docs/documentation/foundamentals/components/text.mdx
index 7107e1c..5ad25b6 100644
--- a/content/docs/documentation/foundamentals/components/text.mdx
+++ b/content/docs/documentation/foundamentals/components/text.mdx
@@ -24,12 +24,26 @@ Markdown supports various text formatting options:
You can create headers from level 1 (largest) to level 6 (smallest):
-```mdx
+```mdx [h1]
# Header 1
+```
+
+# Header 1
+
+```mdx [h2]
+## Header 2
+```
## Header 2
+```mdx [h3]
+### Header 3
+```
+
### Header 3
+```mdx [h4]
#### Header 4
```
+
+#### Header 4
diff --git a/content/docs/documentation/foundamentals/docs.mdx b/content/docs/documentation/foundamentals/docs.mdx
index e4fb347..567f127 100644
--- a/content/docs/documentation/foundamentals/docs.mdx
+++ b/content/docs/documentation/foundamentals/docs.mdx
@@ -23,9 +23,7 @@ To organise the documentation, each section or complete documentation must be co
Each documentation folder must contain a configuration file named `_default.md`. This file defines the metadata for the section, and its front matter must follow the following structure :
-:::codegroup labels=[Tree]
-
-```
+```plain [Tree]
├── content/
│ ├── [...page]
│ └── docs/
@@ -35,13 +33,11 @@ Each documentation folder must contain a configuration file named `_default.md`.
│ └── second_file.mdx
```
-:::
-
The configuration file is structured in the form of standardised `frontmatter`, which allows various information to be defined.
-:::codegroup labels=[_example.mdx, Collection]
+:::codegroup
-```mdx
+```mdx [example]
---
label: My documentation
directory: my_doc
@@ -54,7 +50,7 @@ collection:
---
```
-```ts
+```ts [Collection]
export const docDefaultSchema = z.object({
label: z.string(),
description: z.string(),
@@ -82,9 +78,9 @@ export const docDefaultSchema = z.object({
The other Markdown files (`.md` or `.mdx`) in the same folder represent the individual pages of the documentation. The front matter of each of these files must comply with the following schema :
-:::codegroup labels=[first_file.mdx, Collection]
+:::codegroup
-```mdx
+```mdx [first_file.mdx]
---
title: First file
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
@@ -95,7 +91,7 @@ visibility:
---
```
-```typescript
+```typescript [Collection]
export const docSchema = z.object({
title: z.string(),
description: z.string(),
diff --git a/content/docs/documentation/foundamentals/routing.mdx b/content/docs/documentation/foundamentals/routing.mdx
index 7ba30e3..27caaf4 100644
--- a/content/docs/documentation/foundamentals/routing.mdx
+++ b/content/docs/documentation/foundamentals/routing.mdx
@@ -9,8 +9,9 @@ icon: lucide:signpost
Routing is an important part of any content-driven website, allowing you to create dynamic or static pages for your site.
-> [!important]
-> The `blog` and `docs` folders are special collections; they should be considered separate from routing.
+:::callout{variant="info"}
+The `blog` and `docs` folders are special collections; they should be considered separate from routing.
+:::
---
@@ -18,16 +19,19 @@ Routing is an important part of any content-driven website, allowing you to crea
All of your routes must be defined within the `content/` folder.
-> [!note]
-> Each file representing a new page must be written in markdown format `md` or `mdx`.
+:::callout{variant="info"}
+Each file representing a new page must be written in markdown format `md` or `mdx`.
+:::
Let us consider the desire to create a new `/about` page within our site, we should create an `about` markdown file in the `content/` folder.
-:::codegroup labels=[about.mdx]
+:::codegroup
-```
+```plain [Url]
https://{hostname}/about
+```
+```plain [Tree]
├── content/
│ └── about.mdx
```
@@ -41,15 +45,15 @@ https://{hostname}/about
It is possible to create nested routes by creating a folder with the same name as the route in the `content/` folder.
In this example we will create two nested routes `/about` and `/hello/world`.
-:::codegroup labels=[about.mdx, world.mdx]
+:::codegroup
-```
+```plain [about.mdx]
├── content/
│ └── about/
│ └── index.mdx
```
-```
+```plain [world.mdx]
├── content/
│ └── hello/
│ └── world.mdx
diff --git a/content/docs/documentation/getting-started/configuration.mdx b/content/docs/documentation/getting-started/configuration.mdx
index 16389ff..665e992 100644
--- a/content/docs/documentation/getting-started/configuration.mdx
+++ b/content/docs/documentation/getting-started/configuration.mdx
@@ -13,7 +13,7 @@ The project configuration is simple and centralized in the `explainer.config.ts`
This file uses the `defineExplainerConfig` function to define all the configurations for the site. Here is an overview of the different configuration sections available:
-```ts
+```ts [explainer.config.ts]
import { defineExplainerConfig } from "@/utils";
export default defineExplainerConfig({
diff --git a/content/docs/documentation/getting-started/deploy.mdx b/content/docs/documentation/getting-started/deploy.mdx
index 523dd91..01d1c10 100644
--- a/content/docs/documentation/getting-started/deploy.mdx
+++ b/content/docs/documentation/getting-started/deploy.mdx
@@ -15,11 +15,13 @@ Your environment must support installing Playwrite and its browsers in order for
Explainer provides a GitHub Actions workflow to deploy your static site to a Cloudflare Pages environment.
-> [!NOTE]
-> Cloudflare does not allow the installation of Playwright or its browsers.
-> You must use an external CI/CD pipeline to generate the diagrams and then push them to your Cloudflare Pages environment.
+:::callout{variant="info"}
+Cloudflare does not allow the installation of Playwright or its browsers.
-```yaml
+You must use an external CI/CD pipeline to generate the diagrams and then push them to your Cloudflare Pages environment.
+:::
+
+```yaml [.github/workflows/deploy.yml]
name: Astro CI/CD with Playwright & Cloudflare Pages
on:
diff --git a/content/docs/documentation/getting-started/getting-started.mdx b/content/docs/documentation/getting-started/getting-started.mdx
index af3f875..3895dcd 100644
--- a/content/docs/documentation/getting-started/getting-started.mdx
+++ b/content/docs/documentation/getting-started/getting-started.mdx
@@ -10,6 +10,3 @@ icon: lucide:info
## Introduction
Explainer provides a rich set of components that can be used directly in your Markdown files. This documentation outlines the various markdown components available for creating beautiful, interactive documentation.
-
-:::card-group{cols=2}
-:::
diff --git a/content/docs/documentation/getting-started/project-structure.mdx b/content/docs/documentation/getting-started/project-structure.mdx
index ec3a9fc..cda7e65 100644
--- a/content/docs/documentation/getting-started/project-structure.mdx
+++ b/content/docs/documentation/getting-started/project-structure.mdx
@@ -7,7 +7,7 @@ icon: lucide:layout-panel-top
# Project Structure
-```
+```plain [Tree project]
├── content/
│ ├── [...page]
│ │
@@ -56,12 +56,14 @@ The `content` folder is divided into two parts:
The `docs` directory contains all your documentation content organized by collections.
-> [!NOTE]
-> Please refer to the dedicated [section](/docs/framework/docs) for more information.
+:::callout{variant="info"}
+Please refer to the dedicated [section](/docs/framework/docs) for more information.
+:::
### Blog Structure
The `blog` directory contains all your blog articles.
-> [!NOTE]
-> Please refer to the dedicated [section](/docs/framework/blog) for more information.
+:::callout{variant="info"}
+Please refer to the dedicated [section](/docs/framework/blog) for more information.
+:::
diff --git a/explainer.config.ts b/explainer.config.ts
index 13594f5..e1da083 100644
--- a/explainer.config.ts
+++ b/explainer.config.ts
@@ -1,3 +1,4 @@
+import Callout from "@/components/content/callout.astro";
import CardGroup from "@/components/content/card-group/card-group.astro";
import Card from "@/components/content/card-group/card.astro";
import CodeGroup from "@/components/content/code-group/code-group.astro";
@@ -49,6 +50,7 @@ export default defineExplainerConfig({
codegroup: CodeGroup,
"code-group": CodeGroup,
pre: CodeBlock,
+ callout: Callout,
},
icons: {
markdown: "devicon:markdown",
diff --git a/src/lib/components/content/callout.astro b/src/lib/components/content/callout.astro
new file mode 100644
index 0000000..a3be9d2
--- /dev/null
+++ b/src/lib/components/content/callout.astro
@@ -0,0 +1,81 @@
+---
+import { cn } from "@/utils";
+import { Icon } from "@iconify/react";
+import { undefined } from "astro:schema";
+
+type Props = {
+ to: string;
+ text?: string;
+ variant?: Variant;
+};
+
+const props = Astro.props;
+
+type Variant = "info" | "success" | "warning" | "danger";
+
+const icons: Record = {
+ info: "lucide:info",
+ success: "lucide:lightbulb",
+ warning: "lucide:triangle-alert",
+ danger: "lucide:circle-alert",
+};
+
+const variants: Record & Record<"_default", string> = {
+ _default: "bg-background !text-muted-foreground",
+ info: "bg-blue-50 border-blue-200 !text-blue-500",
+ success: "bg-green-50 border-green-300 !text-green-700",
+ warning: "bg-yellow-50 border-orange-200 !text-yellow-700",
+ danger: "bg-red-100 border-red-300 !text-red-500",
+};
+
+const currentIcon = props.variant ? icons[props.variant] : undefined;
+const currentVariant = variants[props.variant ?? "_default"];
+---
+
+