Dave Jarvis' Repositories

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

Updates syntax highlighting for markdown files

Author Dave Jarvis <email>
Date 2026-02-14 20:47:50 GMT-0800
Commit 45bc8241cf012e2e33ebd467402855e8df9f23aa
Parent 49ec831
Delta 14 lines added, 9 lines removed, 5-line increase
render/LanguageDefinitions.php
],
'markdown' => [
- 'comment' => '/()/s',
- 'keyword' => '/^(#{1,6}\s+.*)$/m',
- 'string' => '/(\*\*.*?\*\*|__.*?__|\*.*?\*|_.*?_)/',
- 'variable' => '/(\[.*?\]\(.*?\))/',
- 'number' => '/^(\s*[-*+]\s|\s*\d+\.\s)/m',
+ 'comment' => '/(```[\s\S]*?```|~~~[\s\S]*?~~~)/', // Fenced code blocks
+ 'keyword' => '/^(#{1,6})(?=\s)/m', // Heading markers only (# ## ###)
+ 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/', // Bold text
+ 'attribute' => '/(?<!\*)(\*[^\n*]+\*)(?!\*)|(?<!_)(_[^\n_]+_)(?!_)/', // Italic text (single * or _)
+ 'function' => '/(`[^`\n]+`)/', // Inline code
+ 'variable' => '/(\[[^\]]+\]\([^\)]+\))/', // Links [text](url)
+ 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m', // List markers
],
'rmd' => [
- 'comment' => '/()/s',
- 'keyword' => '/^(#{1,6}\s+.*)$/m',
- 'variable' => '/(`{3}\{r.*?`{3})/s',
+ 'comment' => '/(```\{r[^\}]*\}[\s\S]*?```)/', // R code blocks with {r}
+ 'keyword' => '/^(#{1,6})(?=\s)/m', // Heading markers only
+ 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/', // Bold text
+ 'attribute' => '/(?<!\*)(\*[^\n*]+\*)(?!\*)|(?<!_)(_[^\n_]+_)(?!_)/', // Italic text
+ 'function' => '/(`[^`\n]+`)/', // Inline code
+ 'variable' => '/(\[[^\]]+\]\([^\)]+\))/', // Links [text](url)
+ 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m', // List markers
],
'r' => [
}
}
-