HUGO

"detail" html tag

Hello,

Does anybody succeed in using markdown syntax into html’s “detail” tag :slight_smile: ?
In my case, markdown syntax is ignored.

Example 1 Using **bold** markdown syntax
Example 2 Using `code` markdown syntax
Example 3 ``` blah ```

Thank u for your help,
Denis

Markdown has no support for this, but you can use a shortcode.

Save this file as “detail-tag.html” to layouts/shortcodes:

    {{ $summary:= .Get 0 }} 
    {{ $content := Get 1 }}

    <details>
      <summary>{{summary}}</summary>
      <p>{{$content}}</p>
    </details>

Use in Markdown:

{< detail-tag "This is an example" "Examples are good for learning things and trying something new" >}

Or, you can just use the HTML tag and add | safeHTML to .content:

# Markdown with HTML
<details>
  <summary>Click to expand!</summary>
  
  ## Heading
  1. An entry
  2. list
     * With some
     * sub entries
</details>
1 Like

Good but a few edits

{{ $summary:= .Get 0 }} 
{{ $content := .Get 1 }}

<details>
    <summary>{{$summary}}</summary>
    <p>{{$content}}</p>
</details>