Continue fleshing out project management system

This commit is contained in:
Alex Cabal 2024-12-16 14:56:10 -06:00
parent 657ecc68d4
commit 051e286a6d
19 changed files with 420 additions and 108 deletions

View file

@ -82,6 +82,20 @@ class Formatter{
return htmlspecialchars(trim($text ?? ''), ENT_QUOTES|ENT_XML1, 'utf-8');
}
/**
* Escape a string for use in Markdown.
*/
public static function EscapeMarkdown(?string $text): string{
if($text === null){
return '';
}
return str_replace(
['\\', '-', '#', '*', '+', '`', '.', '[', ']', '(', ')', '!', '<', '>', '_', '{', '}', '|'],
['\\\\', '\-', '\#', '\*', '\+', '\`', '\.', '\[', '\]', '\(', '\)', '\!', '\<', '\>', '\_', '\{', '\}', '\|'],
$text);
}
/**
* Convert a string of Markdown into HTML.
*/