Closed marcus-at-localhost closed 7 years ago
I close this for now, since it seems to be an issue somewhere else in my chain...
Here is what's happened.
this:
div.x
p 1
div.y
p 2
is correctly rendered as:
<div class="x"><p>1</p></div><div class="y"><p>2</p></div>
then, this fragment is parsed by https://github.com/erusev/parsedown-extra
and parsedown-extra drops every html after the first block, if it's in one line, and just outputs:
<div class="x"><p>1</p></div>
See also: https://github.com/erusev/parsedown-extra/issues/90#issue-142629807
My solution is to turn on prettyprint => true
in Pug and then it works.
Rare use case, but well
Hi, thanks for feedback. I do not understand the point of passing HTML to parsedown-extra.
If what you want is using parsedown inside your pug templates, you should consider using pug filters:
$pug->filter('parsedown', function($node, $compiler){
foreach ($node->block->nodes as $line) {
$output[] = $compiler->interpolate($line->value);
}
$extra = new ParsedownExtra();
return $extra->text(implode("\n", $output));
});
It allow you to do:
div.x
p
:parsedown
# Header {.sth}
Hey, I use Pug to generate HTML fractions without wrapping
<html>
or so.To me it seems like I always need a wrapping parent tag on top.
Situation:
results in
and
results correctly in this:
do I miss something?