Kirbytag and markdown

Hello,

I’m trying to use the downloads kirbytag in 2.4.1 starterkit.

When I add (downloads: dowload file) in text field, it breacks all markdown style of the content bellow the kirbytag.

If I replace H2 in downloads tag by a span, markdown style bellow the tag will show correctly.

Is it a beug ?

Thank you.

I can reproduce that, the issue also disappears if you wrap a div around the whole thing:

<?php

kirbytext::$tags['downloads'] = array(
  'html' => function($tag) {
    $html  = '<div><h2>';
    $html .=  $tag->attr('downloads');
    $html .= '</h2>';
    $html .= '<ul>';

    foreach($tag->page()->documents() as $doc) {
      $html .= '<li>';
      $html .= '<a href="' . $doc->url() . '">' . $doc->filename() . '</a>';
      $html .= '</li>';
    }

    $html .= '</ul></div>';

    return $html;

  }
);

I have no idea why this happens. Maybe the container is always needed for these kind of tags to work properly.

Thank you Texnixe, I will use the Div solution.