feat: add syntax highlighting and code block styling with theme support
This commit is contained in:
+26
-2
@@ -1,9 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-theme="light">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ObsiWatcher - Obsidian Vault Viewer</title>
|
||||
<title>ObsiViewer - Obsidian Vault Viewer</title>
|
||||
<script>
|
||||
(function () {
|
||||
try {
|
||||
const key = 'obsiviewer.preferences.v1';
|
||||
const raw = localStorage.getItem(key);
|
||||
const prefs = raw ? JSON.parse(raw) : null;
|
||||
const html = document.documentElement;
|
||||
|
||||
function apply(mode, theme) {
|
||||
const prefersDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
const dark = mode === 'system' ? prefersDark : (mode === 'dark');
|
||||
html.classList.toggle('dark', !!dark);
|
||||
if (theme) html.setAttribute('data-theme', theme);
|
||||
}
|
||||
|
||||
if (prefs && prefs.mode && prefs.theme) {
|
||||
apply(prefs.mode, prefs.theme);
|
||||
} else {
|
||||
// défaut : system + light tokens
|
||||
apply('system', 'light');
|
||||
}
|
||||
} catch (e) { /* no-op */ }
|
||||
})();
|
||||
</script>
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
|
||||
Reference in New Issue
Block a user