|
| 1 | + |
1 | 2 | --- |
2 | | -title: Admonitions |
| 3 | +title: Admonition Blocks |
3 | 4 | --- |
4 | 5 |
|
5 | | -This guide provides instructions for converting common AsciiDoc admonitions to MyST Markdown format. |
6 | | - |
7 | | -## Admonition Mapping |
8 | | - |
9 | | -| AsciiDoc | MyST Markdown | |
10 | | -|--------------|----------------| |
11 | | -| NOTE | `{note}` | |
12 | | -| TIP | `{tip}` | |
13 | | -| IMPORTANT | `{important}` | |
14 | | -| WARNING | `{warning}` | |
15 | | -| CAUTION | `{caution}` | |
16 | | -| DANGER | `{danger}` | |
17 | | - |
18 | | -### Example Conversion |
19 | | - |
20 | | -In AsciiDoc: |
21 | | -```text |
22 | | -[NOTE] |
23 | | -==== |
24 | | -This is a note. |
25 | | -It can be multiple lines, but not multiple paragraphs. |
26 | | -==== |
27 | | -``` |
28 | | - |
29 | | -In MyST Markdown: |
30 | | -``` |
31 | | -:::{note} |
32 | | -This is a note. |
33 | | -It can be multiple lines, but not multiple paragraphs. |
34 | | -::: |
35 | | -``` |
36 | | - |
37 | | -:::{note} |
38 | | -This is a note. |
39 | | -It can be multiple lines, but not multiple paragraphs. |
40 | | -::: |
41 | | - |
42 | | -## Admonition Paragraphs |
43 | | - |
44 | | -For single-paragraph admonitions, convert them directly to MyST admonition syntax using the appropriate admonition type. Use triple colons `:::` to open and close the block. |
45 | | - |
46 | | -### Example |
47 | | - |
48 | | -In AsciiDoc: |
49 | | -```text |
50 | | -[WARNING] |
51 | | -==== |
52 | | -This is a warning paragraph. |
53 | | -==== |
54 | | -``` |
| 6 | +Admonition blocks allow you to highlight important information with varying levels of priority. In software documentation, these blocks are used to emphasize risks, provide helpful advice, or share relevant but non-critical details. |
55 | 7 |
|
56 | | -In MyST Markdown: |
57 | | -``` |
58 | | -:::{warning} |
59 | | -This is a warning paragraph. |
60 | | -::: |
61 | | -``` |
| 8 | +Admonitions are critical for: |
| 9 | +- Preventing data loss or security issues. |
| 10 | +- Improving system performance and stability. |
| 11 | +- Offering helpful tips for better product usage. |
62 | 12 |
|
63 | | -:::{warning} |
64 | | -This is a warning paragraph. |
65 | | -::: |
| 13 | +--- |
66 | 14 |
|
67 | | -## Multi-Paragraph Admonitions |
| 15 | +## Types of Admonitions |
68 | 16 |
|
69 | | -In AsciiDoc, multi-paragraph admonitions are formatted the same as single paragraphs. In MyST, you can still use the admonition type but separate paragraphs with blank lines. |
| 17 | +| **Type** | **When to use it** | |
| 18 | +|--------------|-----------------------------------------------------------------------------------| |
| 19 | +| **Warning** | You could permanently lose data or leak sensitive information. | |
| 20 | +| **Important**| Ignoring the information could impact performance or the stability of your system.| |
| 21 | +| **Note** | A relevant piece of information with no serious repercussions if ignored. | |
| 22 | +| **Tip** | Advice to help you make better choices when using a feature. | |
70 | 23 |
|
71 | | -### Example |
| 24 | +--- |
72 | 25 |
|
73 | | -In AsciiDoc: |
74 | | -```text |
75 | | -[IMPORTANT] |
76 | | -==== |
77 | | -This is an important note. |
78 | | -It contains multiple paragraphs. |
| 26 | +`````{tab-set} |
79 | 27 |
|
80 | | -Make sure to read it carefully. |
81 | | -==== |
82 | | -``` |
| 28 | +````{tab-item} Asciidoc Syntax |
83 | 29 |
|
84 | | -In MyST Markdown: |
85 | | -``` |
86 | | -:::{important} |
87 | | -This is an important note. |
88 | | -It contains multiple paragraphs. |
| 30 | +To create admonitions in Asciidoc, you can use inline or block syntax. |
89 | 31 |
|
90 | | -Make sure to read it carefully. |
91 | | -::: |
| 32 | +**Inline Admonition:** |
92 | 33 | ``` |
93 | | - |
94 | | -:::{important} |
95 | | -This is an important note. |
96 | | -It contains multiple paragraphs. |
97 | | - |
98 | | -Make sure to read it carefully. |
99 | | -::: |
100 | | - |
101 | | -## Custom Titles for Admonitions |
102 | | - |
103 | | -To give an admonition a custom title in MyST, use the `admonition` directive with a `class` attribute. This is useful if you want to style the block as one of the core admonition types but need a custom title. |
104 | | - |
105 | | -### Example |
106 | | - |
107 | | -In AsciiDoc: |
108 | | -```text |
109 | | -[NOTE] |
110 | | -.Title goes here |
111 | | -==== |
112 | | -This note has a custom title. |
113 | | -==== |
| 34 | +NOTE: This is a note. |
| 35 | +It can be multiple lines, but not multiple paragraphs. |
114 | 36 | ``` |
115 | 37 |
|
116 | | -In MyST Markdown: |
| 38 | +**Block Admonition:** |
117 | 39 | ``` |
118 | | -:::{admonition} Title goes here |
119 | | -:class: note |
| 40 | +[WARNING] |
| 41 | +======= |
| 42 | +This is a warning. |
120 | 43 |
|
121 | | -This note has a custom title. |
122 | | -::: |
| 44 | +It can contain multiple paragraphs. |
| 45 | +======= |
123 | 46 | ``` |
| 47 | +```` |
124 | 48 |
|
125 | | -:::{admonition} Title goes here |
126 | | -:class: note |
127 | | - |
128 | | -This note has a custom title. |
129 | | -::: |
130 | | - |
131 | | -## Collapsible Admonitions |
| 49 | +````{tab-item} MD Syntax |
132 | 50 |
|
133 | | -In MyST Markdown, you can make an admonition collapsible by adding a `dropdown` class, provided by the `sphinx-togglebutton` extension. |
| 51 | +The new build system uses MyST Markdown directives for admonitions. |
134 | 52 |
|
135 | | -### Example |
| 53 | +**Basic Syntax:** |
136 | 54 |
|
| 55 | +```{note} |
| 56 | +This is a note. |
| 57 | +It can span multiple lines and supports inline formatting. |
137 | 58 | ``` |
138 | | -:::{note} |
139 | | -:class: dropdown |
140 | 59 |
|
141 | | -This admonition can be collapsed, making it useful for longer notes or instructions. |
142 | | -::: |
143 | | -``` |
| 60 | +**Available Types:** |
| 61 | +- `note` |
| 62 | +- `caution` |
| 63 | +- `tip` |
| 64 | +- `attention` |
| 65 | +```` |
| 66 | +````` |
144 | 67 |
|
145 | | -:::{note} |
146 | | -:class: dropdown |
| 68 | +## Related Issues |
147 | 69 |
|
148 | | -This admonition can be collapsed, making it useful for longer notes or instructions. |
149 | | -::: |
| 70 | +- |
0 commit comments