Skip to content

Commit 0c9d793

Browse files
committed
feat: implement callout
1 parent b96530b commit 0c9d793

20 files changed

Lines changed: 252 additions & 215 deletions

astro.config.mjs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import rehypeMermaid from "rehype-mermaid";
1818
import rehypeBlogListReact from "./src/lib/plugins/blog-list/plugin";
1919
import remarkBlockParser from "./src/lib/plugins/parser/plugin";
2020
import remarkDirectivePkg from "remark-directive";
21-
import remarkReadMoreDirective from "./src/lib/plugins/read-more/remark-directive";
2221
import sitemap from "@astrojs/sitemap";
2322
import { buildDocIntegration } from "./src/hooks/build-doc";
2423
import transformerMetaLabel from "./src/lib/plugins/shiki/transformer-meta-label";
@@ -49,11 +48,7 @@ export default defineConfig({
4948
type: "shiki",
5049
excludeLangs: ["mermaid"],
5150
},
52-
remarkPlugins: [
53-
remarkDirectivePkg,
54-
remarkBlockParser,
55-
remarkReadMoreDirective,
56-
],
51+
remarkPlugins: [remarkDirectivePkg, remarkBlockParser],
5752
rehypePlugins: [
5853
rehypeMermaid,
5954
[

content/docs/documentation/foundamentals/components/_default.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ collection:
1010
- markdown
1111
- text
1212
- card
13+
- callout
1314
---

content/docs/documentation/foundamentals/components/alert.mdx

Lines changed: 0 additions & 62 deletions
This file was deleted.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
title: Callout
3+
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
4+
permalink: callout
5+
icon: lucide:tag
6+
---
7+
8+
# Callouts
9+
10+
## Basic callouts
11+
12+
### Info
13+
14+
:::callout{variant="info"}
15+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
16+
:::
17+
18+
```
19+
:::callout{variant="info"}
20+
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
21+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
22+
:::
23+
```
24+
25+
---
26+
27+
### Success
28+
29+
:::callout{variant="success"}
30+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
31+
:::
32+
33+
```
34+
:::callout{variant="success"}
35+
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
36+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
37+
:::
38+
```
39+
40+
---
41+
42+
### Warning
43+
44+
:::callout{variant="warning"}
45+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
46+
:::
47+
48+
```
49+
:::callout{variant="warning"}
50+
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
51+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
52+
:::
53+
```
54+
55+
---
56+
57+
### Danger
58+
59+
:::callout{variant="danger"}
60+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
61+
:::
62+
63+
```
64+
:::callout{variant="danger"}
65+
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
66+
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
67+
:::
68+
```
69+
70+
---
71+
72+
## Children
73+
74+
:::callout
75+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
76+
77+
```rs [main.rs]
78+
pub fn main() {
79+
println!("Hello, world!");
80+
}
81+
```
82+
83+
:::
84+
85+
````
86+
:::callout
87+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
88+
89+
```rs [main.rs]
90+
pub fn main() {
91+
println!("Hello, world!");
92+
}
93+
```
94+
95+
:::
96+
````

content/docs/documentation/foundamentals/components/code-block.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,24 @@ pub struct User {
8686
}
8787
```
8888

89+
## Include embedded code blocks
90+
91+
```rs [entities/user.rs]
92+
pub struct User {
93+
pub firstname: String,
94+
pub lastname: String,
95+
}
96+
```
97+
98+
````
99+
```rs [entities/user.rs]
100+
pub struct User {
101+
pub firstname: String,
102+
pub lastname: String,
103+
}
104+
```
105+
````
106+
89107
---
90108

91109
## Line modifiers

content/docs/documentation/foundamentals/components/markdown.mdx

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,36 +33,27 @@ You can create ordered and unordered lists:
3333

3434
You can create links using the `[text](url)` syntax:
3535

36-
```mdx
36+
```mdx [Simple link]
3737
[Google](https://www.google.com)
3838
```
3939

4040
## Images
4141

4242
You can add images using the `![alt text](image.png)` syntax:
4343

44-
```mdx
44+
```mdx [Simple image]
4545
![Explainer Logo](https://placehold.co/600x400)
4646
```
4747

4848
![Explainer Logo](https://placehold.co/600x400)
4949

50-
## Code Blocks
51-
52-
You can add code blocks using the ``` syntax:
53-
54-
```dart
55-
print("Hello, World!")
56-
```
57-
58-
> [!NOTE]
59-
> See more about [code blocks](/docs/syntax/code-blocks)
50+
---
6051

6152
## Tables
6253

6354
You can create tables using the `|` syntax:
6455

65-
```mdx
56+
```mdx [Simple table]
6657
| Header 1 | Header 2 | Header 3 |
6758
| -------- | -------- | -------- |
6859
| Cell 1 | Cell 2 | Cell 3 |

content/docs/documentation/foundamentals/components/text.mdx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,26 @@ Markdown supports various text formatting options:
2424

2525
You can create headers from level 1 (largest) to level 6 (smallest):
2626

27-
```mdx
27+
```mdx [h1]
2828
# Header 1
29+
```
30+
31+
# Header 1
32+
33+
```mdx [h2]
34+
## Header 2
35+
```
2936

3037
## Header 2
3138

39+
```mdx [h3]
40+
### Header 3
41+
```
42+
3243
### Header 3
3344

45+
```mdx [h4]
3446
#### Header 4
3547
```
48+
49+
#### Header 4

content/docs/documentation/foundamentals/docs.mdx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ To organise the documentation, each section or complete documentation must be co
2323

2424
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 :
2525

26-
:::codegroup labels=[Tree]
27-
28-
```
26+
```plain [Tree]
2927
├── content/
3028
│ ├── [...page]
3129
│ └── docs/
@@ -35,13 +33,11 @@ Each documentation folder must contain a configuration file named `_default.md`.
3533
│ └── second_file.mdx
3634
```
3735

38-
:::
39-
4036
The configuration file is structured in the form of standardised `frontmatter`, which allows various information to be defined.
4137

42-
:::codegroup labels=[_example.mdx, Collection]
38+
:::codegroup
4339

44-
```mdx
40+
```mdx [example]
4541
---
4642
label: My documentation
4743
directory: my_doc
@@ -54,7 +50,7 @@ collection:
5450
---
5551
```
5652

57-
```ts
53+
```ts [Collection]
5854
export const docDefaultSchema = z.object({
5955
label: z.string(),
6056
description: z.string(),
@@ -82,9 +78,9 @@ export const docDefaultSchema = z.object({
8278

8379
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 :
8480

85-
:::codegroup labels=[first_file.mdx, Collection]
81+
:::codegroup
8682

87-
```mdx
83+
```mdx [first_file.mdx]
8884
---
8985
title: First file
9086
description: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
@@ -95,7 +91,7 @@ visibility:
9591
---
9692
```
9793

98-
```typescript
94+
```typescript [Collection]
9995
export const docSchema = z.object({
10096
title: z.string(),
10197
description: z.string(),

content/docs/documentation/foundamentals/routing.mdx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,29 @@ icon: lucide:signpost
99

1010
Routing is an important part of any content-driven website, allowing you to create dynamic or static pages for your site.
1111

12-
> [!important]
13-
> The `blog` and `docs` folders are special collections; they should be considered separate from routing.
12+
:::callout{variant="info"}
13+
The `blog` and `docs` folders are special collections; they should be considered separate from routing.
14+
:::
1415

1516
---
1617

1718
## Routing Basics
1819

1920
All of your routes must be defined within the `content/` folder.
2021

21-
> [!note]
22-
> Each file representing a new page must be written in markdown format `md` or `mdx`.
22+
:::callout{variant="info"}
23+
Each file representing a new page must be written in markdown format `md` or `mdx`.
24+
:::
2325

2426
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.
2527

26-
:::codegroup labels=[about.mdx]
28+
:::codegroup
2729

28-
```
30+
```plain [Url]
2931
https://{hostname}/about
32+
```
3033

34+
```plain [Tree]
3135
├── content/
3236
│ └── about.mdx
3337
```
@@ -41,15 +45,15 @@ https://{hostname}/about
4145
It is possible to create nested routes by creating a folder with the same name as the route in the `content/` folder.
4246
In this example we will create two nested routes `/about` and `/hello/world`.
4347

44-
:::codegroup labels=[about.mdx, world.mdx]
48+
:::codegroup
4549

46-
```
50+
```plain [about.mdx]
4751
├── content/
4852
│ └── about/
4953
│ └── index.mdx
5054
```
5155

52-
```
56+
```plain [world.mdx]
5357
├── content/
5458
│ └── hello/
5559
│ └── world.mdx

0 commit comments

Comments
 (0)