Dave Jarvis' Repositories

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

Makes colours more like Monokai pro

AuthorDave Jarvis <email>
Date2026-02-14 19:41:34 GMT-0800
Commit6561f9c194ed9fa512768bdda9d721a2edf571ca
Parent7a33296
render/Highlighter.php
$delim = $pattern[0];
$inner = substr($pattern, 1, strrpos($pattern, $delim) - 1);
- // Fix: Use $name for the capture group instead of hardcoding 'punctuation'
$patterns[] = "(?P<$name>$inner)";
}
- // Fix: Move punctuation outside the loop as a global fallback
$patterns[] = "(?P<punctuation>[\\{\\}\\(\\)\\[\\]\\;\\,])";
$combined = '/' . implode('|', $patterns) . '/msu';
foreach ($parts as $part) {
- if (str_starts_with($part, '$')) {
- $output .= '<span class="hl-variable">' . htmlspecialchars($part) . '</span>';
+ if (str_starts_with($part, '${') && str_ends_with($part, '}')) {
+ $inner = substr($part, 2, -1);
+ $output .= '<span class="hl-interp-punct">${</span>';
+ $output .= '<span class="hl-variable">' . htmlspecialchars($inner) . '</span>';
+ $output .= '<span class="hl-interp-punct">}</span>';
+ } elseif (str_starts_with($part, '$')) {
+ $output .= '<span class="hl-interp-punct">$</span>';
+ $output .= '<span class="hl-variable">' . htmlspecialchars(substr($part, 1)) . '</span>';
} else {
$output .= htmlspecialchars($part);
repo.css
}
-.hl-keyword {
- color: #ff7b72;
+.hl-keyword,
+.hl-tag {
+ color: #5ad4e6;
}
.hl-comment {
- color: #8b949e;
+ color: #75715e;
font-style: italic;
}
.hl-string,
.hl-string_interp {
- color: #7ee787;
+ color: #e6db74;
}
.hl-variable {
- color: #ffa657;
+ color: inherit;
}
.hl-number {
- color: #d29922;
- font-weight: bold;
+ color: #ae81ff;
+ font-weight: normal;
}
.hl-punctuation {
- color: #c9d1d9;
+ color: #f8f8f2;
}
-.hl-tag {
- color: #ff7b72;
+.hl-interp-punct {
+ color: #f92672;
}
Delta19 lines added, 14 lines removed, 5-line increase