Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git

Highlights Markdown code blocks

Author Dave Jarvis <email>
Date 2026-02-14 20:57:27 GMT-0800
Commit d39205dbb6d9f4c9d50cea009ec40c2b51d87a9b
Parent 0b6d291
Delta 2 lines added, 1 line removed, 1-line increase
render/Highlighter.php
}
- // Skip punctuation highlighting for markdown-like languages
if (!in_array($this->lang, ['markdown', 'rmd'])) {
$patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
render/LanguageDefinitions.php
'markdown' => [
'comment' => '/(```[\s\S]*?```|~~~[\s\S]*?~~~)/',
+ 'code' => '/^( .+)$/m',
'keyword' => '/^(#{1,6})(?=\s)/m',
'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/',
'attribute' => '/(?<!\*)(\*[^\n*]+\*)(?!\*)|(?<!_)(_[^\n_]+_)(?!_)/',
'function' => '/(`[^`\n]+`)/',
'variable' => '/(\[[^\]]+\]\([^\)]+\))/',
'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m',
],
'rmd' => [
'comment' => '/(```\{r[^\}]*\}[\s\S]*?```)/',
+ 'code' => '/^( .+)$/m',
'keyword' => '/^(#{1,6})(?=\s)/m',
'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/',