mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
Fix dolMd2Html
This commit is contained in:
@@ -31,6 +31,14 @@
|
||||
*/
|
||||
function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null)
|
||||
{
|
||||
// Replace a HTML string with a Markdown syntax
|
||||
$content = preg_replace('/<a href="([^"]+)">([^<]+)<\/a>/', '[\2](\1)', $content);
|
||||
//$content = preg_replace('/<a href="([^"]+)" target="([^"]+)">([^<]+)<\/a>/', '[\3](\1){:target="\2"}', $content);
|
||||
$content = preg_replace('/<a href="([^"]+)" target="([^"]+)">([^<]+)<\/a>/', '[\3](\1)', $content);
|
||||
|
||||
// Replace HTML coments
|
||||
$content = preg_replace('/<!--.*-->/ms', '', $content); // We remove HTML comment that are not MD comment because they will be escaped and output when setSafeMode is set to true.
|
||||
|
||||
if (is_array($replaceimagepath)) {
|
||||
foreach ($replaceimagepath as $key => $val) {
|
||||
$keytoreplace = ']('.$key;
|
||||
|
||||
Reference in New Issue
Block a user