diff --git a/plugins/smolnet.py b/plugins/smolnet.py index 0937e23..c571521 100644 --- a/plugins/smolnet.py +++ b/plugins/smolnet.py @@ -31,6 +31,8 @@ setting, and every setting has a default, so a site can switch it on with just Notes section; off by default since not every site using this plugin has been checked for footnotes + SMOLNET_CALLOUTS {} callout kind -> label, for `> [!kind]` + blocks; see rewrite_callouts Every run of links here is a **Markdown list**, which is what each format needs: Mews Profile reads a dated link as a feed entry only when it starts a list item @@ -120,6 +122,9 @@ FOOTNOTE_REF = re.compile(r"\[\^([^\]]+)\]") # citation it was meant to carry. LINKREF_DEF = re.compile(r"^\[(\d+)\]:", re.MULTILINE) +# The opening line of a GitHub/Obsidian-style callout, "> [!kind] title". +CALLOUT = re.compile(r"^([ ]{0,3}>[ ]?)\[!(\w+)\][ \t]*(.*)$", re.MULTILINE) + def rot13(text): """The obfuscation used on addresses in the HTML templates.""" @@ -322,6 +327,33 @@ def rewrite_footnotes(text, labels, warn): return body.rstrip() + "\n\n" + "\n".join(notes) + "\n" +def rewrite_callouts(text, kinds): + """Turn a `> [!kind]` marker into a bold label line, leaving the rest of + the passage an ordinary blockquote. + + The HTML build renders these as boxes (an