Skip to content

Commit 7d5c4be

Browse files
committed
Quotes: Add nesting examples, fix some grammar, and add nesting test
1 parent 9d5b64a commit 7d5c4be

File tree

3 files changed

+88
-17
lines changed

3 files changed

+88
-17
lines changed

docs/src/markdown/extensions/quotes.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ blocks.
2929
```
3030
///
3131

32-
The problem with this approach is that if you have a need to have two separate blockquotes, this because difficult.
32+
The problem with this approach is that if you have a need to have two separate blockquotes, this becomes difficult.
3333

34-
The Quotes extensions follows logic that is seen in more modern approaches to Markdown.
34+
The Quotes extensions follows logic that is seen in more modern approaches to Markdown where each blockquote is distinct
35+
and separate.
3536

3637
```text title="Separate Blockquotes"
3738
> This is a paragraph
@@ -47,9 +48,11 @@ The Quotes extensions follows logic that is seen in more modern approaches to Ma
4748

4849
It should be noted that since this extension does not use lazy formatting, you should be stricter with your leading
4950
blockquote `>`. For instance, when using [SuperFences](./superfences.md), you will find that these must be fully
50-
contained in the blockquotes. In the past, the lazy handling would have allowed for
51+
contained in the blockquotes. In the past, the lazy handling would have allowed a more relaxed behavior.
5152

5253
````text title="Blockquotes and SuperFences"
54+
This will work.
55+
5356
> ```
5457
> Test
5558
>
@@ -89,14 +92,21 @@ This will not.
8992
as alerts or callouts) by using a special syntax at the start of a blockquote. While Obsidian does this with a more
9093
feature rich syntax, GitHub offers a more stripped down version.
9194
92-
The Quotes extensions allows you to opt-in approach to specifying admonitions in a similar approach that is compatible
93-
with Obsidian and GitHub if usage is limited to what they offer.
95+
The Quotes extensions allows you to opt-in to specifying admonitions in a similar approach that is compatible with
96+
Obsidian and GitHub.
97+
98+
/// note
99+
GitHub only supports the simple, single class notation, and only recognizes specific classes.
100+
101+
Quotes does not physically add restrictions to which classes you can specify, or how many, but if compatibility is
102+
desired, take note of what GitHub supports. Learn more [here][github-alerts].
103+
///
94104
95105
Quotes will take the special blockquote syntax and output HTML that matches the output of [Admonitions][admonition] or
96106
[Details](./details.md).
97107
98108
To specify normal callouts, simply ensure the that the first line of a blockquote contains a class name in within
99-
`[!...]`.
109+
`[!<type>]` where `<type>` is the specific callout type.
100110
101111
```text title="Callout"
102112
> [!note]
@@ -108,13 +118,6 @@ To specify normal callouts, simply ensure the that the first line of a blockquot
108118
> Here is a note
109119
///
110120

111-
/// note
112-
GitHub only supports the simple class notation, and only recognizes the classes: note, tip, important, warning, caution.
113-
114-
There are no restrictions as to which classes you can specify, but if cross compliance is desired, take note of what
115-
GitHub supports. Learn more [here][github-alerts].
116-
///
117-
118121
Borrowing from Obsidian, Quotes also enables a few more advanced features. If you'd like a custom title, simply provide
119122
one on the same line as the class specifier. If one is not provided, a title is sourced from the first the class.
120123

@@ -140,9 +143,9 @@ To make a collapsible callout, just add `+` (open) or `-` (closed) immediately a
140143
> I'm collapsible.
141144
///
142145

143-
Lastly, if you need to specify more multiple classes, you can utilize the Obsidian approach and and separate each class
144-
with `|`. The first class will be used as the main title if no title is provided, but all classes will be applied to the
145-
callout.
146+
Lastly, if you need to specify multiple classes, you can utilize the Obsidian approach and separate each class with `|`.
147+
The first class will be used as the type and also the title if no title is provided, but all classes will be applied to
148+
the callout.
146149

147150
```text title="Collapsible Callout"
148151
> [!warning | inline | end]
@@ -158,6 +161,34 @@ A paragraph.
158161
A paragraph.
159162
///
160163

164+
While GitHub does not support nesting, nesting is also supported which aligns with Obsidian.
165+
166+
```text title="Nesting"
167+
> [!note]
168+
> Content
169+
> > [!danger]
170+
> > Content
171+
> > > [!important]
172+
> > > Content
173+
> >
174+
> > Content
175+
>
176+
> > [!tip]
177+
```
178+
179+
/// html | div.result
180+
> [!note]
181+
> Content
182+
> > [!danger]
183+
> > Content
184+
> > > [!important]
185+
> > > Content
186+
> >
187+
> > Content
188+
>
189+
> > [!tip]
190+
///
191+
161192
## Options
162193

163194
Option | Type | Default | Description

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ legacy_tox_ini = """
160160
commands=
161161
{envpython} -m pip install .
162162
{envpython} -m zensical build -f zensical.yml --clean --strict
163-
{envpython} -m pyspelling
163+
{envpython} -m pyspelling -j 8
164164
165165
[testenv:lint]
166166
deps=

tests/test_extensions/test_quotes.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,43 @@ def test_multi_class(self):
209209
""",
210210
True
211211
)
212+
213+
def test_nested(self):
214+
"""Test multiple classes."""
215+
216+
self.check_markdown(
217+
"""
218+
> [!note]
219+
> Content
220+
> > [!danger]
221+
> > Content
222+
> > > [!important]
223+
> > > Content
224+
> > Content
225+
> >
226+
> > Content
227+
>
228+
> > [!tip]
229+
""",
230+
"""
231+
<div class="admonition note">
232+
<p class="admonition-title">Note</p>
233+
<p>Content</p>
234+
<div class="admonition danger">
235+
<p class="admonition-title">Danger</p>
236+
<p>Content</p>
237+
<div class="admonition important">
238+
<p class="admonition-title">Important</p>
239+
<p>Content
240+
Content</p>
241+
</div>
242+
<p>Content</p>
243+
</div>
244+
<div class="admonition tip">
245+
<p class="admonition-title">Tip
246+
</p>
247+
</div>
248+
</div>
249+
""",
250+
True
251+
)

0 commit comments

Comments
 (0)