SilkCalloutBlockquoteHandler
Creates a handler for the blockquote type which delegates to the Silk Callout
widget is using silk.
IMPORTANT: It is an error to use this in a project that does not depend on Silk.
When set, Silk can parse blockquotes with a special syntax to generate callouts. For example:
> [!NOTE]
> This is a note.
will generate a note callout.
The default list of callout keywords are, by default, provided by SilkCalloutTypes map, but users can extend this set themselves or provide their own by setting the types parameter:
markdown {
handlers.blockquote = SilkCalloutBlockquoteHandler(
types = SilkCalloutTypes + mapOf("CUSTOM" to ".components.widgets.callouts.CustomCalloutType")
)
}
By default, the label for a callout is the type itself (e.g. "Note", "Tip", etc.). However, the label can be overridden by users on a case-by-case basis by specifying the label inside the callout syntax. For example: [!NOTE "My Custom Label"]
.
But you can also change the default label globally, specifying it in the labels parameter. For example, if you want to set the "QUOTE" type to have an empty label by default (which looks clean), you can set the labels parameter to mapOf("QUOTE" to "")
. NOTE: If you specify a key in labels that isn't also registered in types, it will essentially be ignored.
Finally, you can specify an alternate callout variant to use (perhaps OutlinedCalloutVariant
or something from your own project) by setting the variant parameter. You can specify an override for the variant in markdown by wrapping it in curly braces, like so: [!NOTE {variant = com.varabyte.kobweb.silk.components.display.OutlinedCalloutVariant}]
.