Double linebreak / several hard-returns possible?

Is it possible to create more than one linebreak in the Visual Markdown Editor?



sentence 1

sentence 2


sentence 3




sentence 4

When I enter this in the editor, it outputs;

sentence 1

sentence 2

sentence 3

sentence 4

I tried this in config.php >>> c::set('markdown.breaks', true); but that didn’t work (also tried to end double spaces after an empty line).


Nothing worked, so I ended up with a custom tag (br:#) :frowning:

Which will output the amount of hard returns specified in the tag;

sentence 1
(br:1)
sentence 2
(br:2)
sentence 3
(br:3)
sentence 4


kirbytext::$tags['br'] = array(

  'html' => function($tag)
    {
  $br = $tag->attr('br');
  $break = '';
  $i = 1;

  if(!is_numeric($br)){$br = 1;}

    while ($i <= $br)
      {
    $i++;
    $break .= '<p>&nbsp;</p>';
      }

  return $break;
    }
);

I also asked this question on the GitHub page - but I am not sure this is an issue, or “by design” - so I asked it here again…

That’s not an issue with the Visual Markdown Editor but with the Markdown syntax in general. No matter which field type you use, Kirby (or any other Markdown parser) won’t add <br>s there.

Using a specific number of line breaks to create a gap is not recommended anyway because of semantics (and that’s why Markdown doesn’t support it). Consider using content blocks with custom classes that get their spacing using CSS.

1 Like

Cool - clear answer!

I’ll stick with my own tag then; I need extra line-breaks for an ‘artistic’ text-block (so no need for semantics there).

The visual appearance of this particular text-bucket is more important than it’s semantical-value :slight_smile:

(I used to create this kind of text-buckets in 1993 with the use of a transparent 1x1 GIF pixel… so I’m glad I can upgrade to the Kirby-tag right now!).