Closed ghost closed 6 years ago
I edited your comment so it would include the HTML you wrote visibly (and also importantly the indentation).
While
echo $parsedown->text('# Hello World
<div class="container">Hello World</div>
');
Will not output the HTML you've written as HTML, the following will:
echo $parsedown->text('# Hello World
<div class="container">Hello World</div>
');
Note the difference in indentation. In markdown, four spaces of indentation will produce an "indented code block" (which is why the HTML was being escaped). There's a short cheatsheet here if you wanted to see some of the other syntaxes :)
This is the result for the following code:
echo $parsedown->text('<div class="flol"><h1>' . $row[0] . '</h1><br><h3>By: ' . $row[1] . '</h3><br><br><img height="600" width="800" src="' . $row[2] . '"><br><br><br><p>' . $row[3] . '</p>');
You'd need to add at least two newlines after any HTML before markdown would be recognised again (per spec). Alternatively, if you have static HTML which you want to render before markdown, why not include it before any parsing takes place? e.g.
echo '<div class="flol"><h1>' . $row[0] . '</h1><br><h3>By: ' . $row[1] . '</h3><br><br><img height="600" width="800" src="' . $row[2] . '"><br><br><br>'
. $parsedown->text($row[3])
;
Assuming here that $row[3]
holds the markdown text you want to output?
I know it kind of defeats the purpose of Parsedown, but is there a way to simply also echo tags? For instance: