Skip to content

Commit a583640

Browse files
committed
Add support for Obsidian type blockquote alerts
* Make the alert type parsing more flexible to support more types * Add `AlertTitle` and `AlertSign` (for folding) Note that GitHub will not render callouts with alert title/sign. See https://help.obsidian.md/Editing+and+formatting/Callouts Closes #12805 Closes #12801
1 parent 3e00808 commit a583640

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎content/en/render-hooks/blockquotes.md‎

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ Blockquote render hook templates receive the following [context]:
2424

2525
(`string`) Applicable when [`Type`](#type) is `alert`, this is the alert type converted to lowercase. See the [alerts](#alerts) section below.
2626

27+
###### AlertTitle
28+
29+
{{< new-in 0.134.0 >}}
30+
31+
(`hstring.HTML`) Applicable when [`Type`](#type) is `alert` when using [Obsidian callouts] syntax, this is the alert title converted to HTML.
32+
33+
###### AlertSign
34+
35+
{{< new-in 0.134.0 >}}
36+
37+
(`string`) Applicable when [`Type`](#type) is `alert` when using [Obsidian callouts] syntax, this is one of "+", "-" or "" (empty string) to indicate the presence of a foldable sign.
38+
39+
[Obsidian callouts]: https://help.obsidian.md/Editing+and+formatting/Callouts
40+
2741
###### Attributes
2842

2943
(`map`) The [Markdown attributes], available if you configure your site as follows:
@@ -117,13 +131,13 @@ Also known as _callouts_ or _admonitions_, alerts are blockquotes used to emphas
117131
118132

119133
{{% note %}}
120-
This syntax is compatible with the GitHub Alert Markdown extension.
134+
This syntax is compatible with both the GitHub Alert Markdown extension and Obsidian's callout syntax.
135+
But note that GitHub will not recognize callouts with one of Obsidian's extensions (e.g. callout title or the foldable sign).
121136
{{% /note %}}
122137

123-
124138
The first line of each alert is an alert designator consisting of an exclamation point followed by the alert type, wrapped within brackets.
125139

126-
The blockquote render hook below renders a multilingual alert if an alert desginator is present, otherwise it renders a blockquote according to the CommonMark specification.
140+
The blockquote render hook below renders a multilingual alert if an alert designator is present, otherwise it renders a blockquote according to the CommonMark specification.
127141

128142
{{< code file=layouts/_default/_markup/render-blockquote.html copy=true >}}
129143
{{ $emojis := dict

0 commit comments

Comments
 (0)