', $html); // Parse remaining markdown (outside cards) $html = self::parse_basics($html); return $html; } /** * Parse basic markdown syntax * * @param string $text * @return string */ private static function parse_basics($text) { $html = $text; // Headings (must be done in order from h4 to h1 to avoid conflicts) $html = preg_replace('/^#### (.*)$/m', '

$1

', $html); $html = preg_replace('/^### (.*)$/m', '

$1

', $html); $html = preg_replace('/^## (.*)$/m', '

$1

', $html); $html = preg_replace('/^# (.*)$/m', '

$1

', $html); // Bold $html = preg_replace('/\*\*(.*?)\*\*/s', '$1', $html); $html = preg_replace('/__(.*?)__/s', '$1', $html); // Italic $html = preg_replace('/\*([^\*]+?)\*/', '$1', $html); $html = preg_replace('/_([^_]+?)_/', '$1', $html); // Links (but not button syntax) $html = preg_replace('/\[(?!button)([^\]]+)\]\(([^)]+)\)/', '$1', $html); // Unordered lists (including checkmarks and bullets) $html = preg_replace('/^[\*\-•✓✔] (.*)$/m', '
  • $1
  • ', $html); // Wrap consecutive
  • in