Dave Jarvis' Repositories

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

Updates source code BG and Markdown highlighting

AuthorDave Jarvis <email>
Date2026-02-14 20:53:02 GMT-0800
Commit0b6d291c3f4bce16416466ef1c8dd6ded287e5d1
Parent45bc824
render/Highlighter.php
}
- $patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
+ // Skip punctuation highlighting for markdown-like languages
+ if (!in_array($this->lang, ['markdown', 'rmd'])) {
+ $patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
+ }
+
$patterns[] = "(?P<any>[\s\S])";
$combined = '~' . implode('|', $patterns) . '~msu';
render/LanguageDefinitions.php
'comment' => '/(\/\/[^\r\n]*|\/\*.*?\*\/)/ms',
'string_interp' => '/(".*?"|""".*?""")/',
- 'string' => '/(\'.*?\'|\'\'\'.*?\'\'\'|\/.*?\/)/', // Includes regex literals
+ 'string' => '/(\'.*?\'|\'\'\'.*?\'\'\'|\/.*?\/)/',
'keyword' => '/\b(def|task|apply|plugin|sourceCompatibility|targetCompatibility|repositories|dependencies|test|group|version|plugins|buildscript|allprojects|subprojects|project|ext|implementation|api|compileOnly|runtimeOnly|testImplementation|testRuntimeOnly|mavenCentral|google|jcenter|classpath)\b/',
- 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\{)/', // Gradle tasks often look like taskname {
+ 'function' => '/\b([a-zA-Z_][a-zA-Z0-9_]*)\s*(?=\{)/',
'variable' => '/(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{[^}]+\})/',
'boolean' => '/\b(true|false|null)\b/',
'css' => [
'comment' => '/(\/\*.*?\*\/)/s',
- 'tag' => '/(?<=^|\}|\{)\s*([a-zA-Z0-9_\-#\.\s,>+~]+)(?=\{)/m', /* Selectors */
- 'property' => '/([a-zA-Z-]+)(?=\s*:)/', /* Properties */
+ 'tag' => '/(?<=^|\}|\{)\s*([a-zA-Z0-9_\-#\.\s,>+~]+)(?=\{)/m',
+ 'property' => '/([a-zA-Z-]+)(?=\s*:)/',
'string' => '/' . $str . '/',
'number' => '/(-?(\d*\.)?\d+(px|em|rem|%|vh|vw|s|ms|deg))/',
],
'json' => [
- 'attribute' => '/(".*?")(?=\s*:)/', /* Keys are attributes (orange) in Monokai */
- 'string' => '/(".*?")/', /* Values */
+ 'attribute' => '/(".*?")(?=\s*:)/',
+ 'string' => '/(".*?")/',
'boolean' => '/\b(true|false|null)\b/',
'number' => '/\b(-?\d+(\.\d+)?([eE][+-]?\d+)?)\b/',
],
'markdown' => [
- '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
+ 'comment' => '/(```[\s\S]*?```|~~~[\s\S]*?~~~)/',
+ '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]*?```)/', // 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
+ 'comment' => '/(```\{r[^\}]*\}[\s\S]*?```)/',
+ 'keyword' => '/^(#{1,6})(?=\s)/m',
+ 'string' => '/(\*\*[^\n*]+\*\*|__[^\n_]+__)/',
+ 'attribute' => '/(?<!\*)(\*[^\n*]+\*)(?!\*)|(?<!_)(_[^\n_]+_)(?!_)/',
+ 'function' => '/(`[^`\n]+`)/',
+ 'variable' => '/(\[[^\]]+\]\([^\)]+\))/',
+ 'operator' => '/^(\s*[-*+](?=\s)|\s*\d+\.(?=\s))/m',
],
'r' => [
repo.css
.blob-code {
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
- background-color: #2d2a2e;
+ background-color: #161b22;
color: #fcfcfa;
}
color: #ff6188;
}
-
Delta26 lines added, 23 lines removed, 3-line increase