Open uvulpos opened 3 years ago
Using plain str_replace()
to replace variable after parsed:
$text = $Parsedown->text('Today is: {current_date}');
$vars = [
'current_date' => date('Y-m-d'),
'client' => 'Tom',
// ...
];
foreach ($vars as $var => $value) {
$text = str_replace('{' . $var . '}', $value, $text);
}
echo $text;
This would make sense yes, right now I'm doing it this way but I wish there was something like this as a feature in Markdown
My opinion is that this is not what Markdown was created for. You should use a templating engine for this... something like Mustache.
Hey, I use Parsedown for my Imprint and Privacy Policy so my lawyer can read it and I have to specify some sources from my database. These documents are in one file. How can I insert them? Maybe something like this could be a nice to have feature. At least I found no documentation 🤷🏻♂️