I’m experiencing strange behavior with kirbytext having multiple divs. In the basic example below, all output after the first closing div is suppressed. I’m running Kirby 2.0.6 running on a local environment (Mac OS 10.10) with MAMP.
Is this a bug? How can I have multiple divs in a custom tag?
I love Kirby. Keep up the great work.
<?php
kirbytext::$tags['dummytag'] = array(
'html' => function($tag) {
$html = '<div id="one">';
$html .= '<p>This is the first div</p>';
$html .= '</div>'; //All output after this is suppressed
$html .= '<div id="two">';
$html .= '<p>This is the second div</p>';
$html .= '</div>';
return $html;
}
);
?>
I’m also having some very strange results with custom tags. Like white space not collapsing and broken images with div tags in an unordered list. The broken images are even somewhat random. These problems appeared after version 2.0.5.
I’ve been in contact with Bastian about this and it seems that Parsedown might be causing some problems. That’s why I am hoping that Bastian implements an option to switch back to the original Markdown parser. Which, so I’m told, is ‘slow’ in comparison, but hey it worked imho very well.
I can confirm that the bug is not present for Kirby 2.0.0. With that old version of Kirby, the example kirbytext tag above generates the following code:
<div id="one"><p>This is the first div</p></div><div id="two"><p>This is the second div</p></div>
With the current version of Kirby (2.0.6), the example kirbytext tag generates:
Could you please try with the nightly build: http://download.getkirby.com/nightly. Parsedown — our third-party Markdown parser — acted up a bit in older versions.
This nightly version doesn’t solve my problems with custom Kirby tags not collapsing white space. Divs in unordered lists are properly parsed tough.
Also have some broken images where “placeholder” in the filename of thumbnails completely disappear:
filename: 01-blocks-01-placeholder-2474211f6c8e53190ecbeaae13ac3b40.jpg
parsed: 01-blocks-01–2474211f6c8e53190ecbeaae13ac3b40.jpg
This is not consistent on another page the thumbs are properly displayed. The thumbnails are in a div in an unordered list.
@keith: I’ve also tried your dummytag with kirby-nightly-2.0.7-20150226163831 and it works ok.
(I’m still getting strange behaviour with thumbs in a tag. Like thumbs getting repeated underneath the body text or still displaying after I have deleted the tag. I’m going to rewrite the tag so I can track at which point it fails.)
I just tried it on the default site that comes with the Kirby nightly build (2.1.0 currently) and my dummy tag does work. This means there is something else in my other site that it interfering with how markdown is rendered. Will work on troubleshooting…
Whatever it is, it was not a problem for older versions of Kirby (<2.0.5)
Yes, I must admit that I now am confused. I tried toggling both the extension and markdown extra and now I only get one div. This is on a “clean” Kirby 2.1.0 site.