Hello,
I’m new to Hugo and I’m working with a project created by someone else, that is based on markdown.
I want to add some logic: Open a panel / section including some text when clicking on a button.
Is it possible? any hint?
Thanks!
I think the geekdoc theme’s expand shortcode does what you are looking for: hugo-geekdoc/expand.html at main · thegeeklab/hugo-geekdoc · GitHub
Thank you, I’ll have a look at it. First I’ll look for an introduction tutorial on shortcodes
You could use HTML’s detail/summary
éléments – they’re designed for exactly that purpose.
Thanks @chrillek . have I to embed these HTML’s detail/summary
in the shortcodes or directly in the markdown?
Sorry but I’m an absolute beginner
That’s a matter of taste. I wouldn’t want to use HTML in my MD files, though, if I can avoid that.
Thanks both for your good input.
I could solve my use case in the following way:
- Created a shortcode called code.html like this:
<details>
<summary>{{.Get 0}} </summary>
<pre>
<code>{{.Inner}}</code>
</pre>
</details>
and included it in the md in this way
{{< code Summary >}}
detail to display
{{< /code >}}
Thanks again!
A post was split to a new topic: Creating tabs