nunocoracao / blowfish

Personal Website & Blog Theme for Hugo
https://blowfish.page
MIT License
1.42k stars 397 forks source link

✨ shortcode: callout blocks #971

Open RKonstantinR opened 1 year ago

RKonstantinR commented 1 year ago

Describe the solution you'd like Create a shortcode to insert callout blocks that the user can expand. It would be nice to add additional attributes like: collapse="true" to make it collapse by default, or collapse="false" to make the callout a collapsible that expands by default.

Describe alternatives you've considered Something like shortcode in loveit theme

Additional context Example: https://quarto.org/docs/authoring/callouts.html

wolfspyre commented 1 year ago

https://oostens.me/posts/hugo-shortcodes-with-markdown-gotchas/ geekdoc has a good expand shortcode that can be used for this... but it comes with some interesting caveats.

https://github.com/thegeeklab/hugo-geekdoc/discussions/707

https://github.com/wolfspyre/hugo-geekdoc/tree/expand

alxhslm commented 7 months ago

IIUC this should be pretty trivial with Tailwind. We can do something like the examples here.

Ast3risk-ops commented 2 months ago

I would like to say this is quite similar to the Alert shortcode, so I'd like to focus on making collapsible sections.

I'd like to tack on a possible syntax which follows the style of the Alert shortcode (using % because Markdown > HTML and renderer.unsafe is enabled, not sure if using Markdown here is practically feasible though):

{{% callout title="Your Title" icon="none (or an icon)" open="true/false" background="true/false" color="#000000" iconColor="#000000" textColor="#000000" %}}
**block content**
{{% /callout %}}