vole
Site
Clone
Read only, no credentials:
https://rodent.software/vole.git
Write over SSH with a registered key:
git clone ssh://git@rodent.software/vole.git
Self-hosted forge that lives in your Git repo.
Rewrite documentation around reader tasks
d1f44d838966c0a4762073f12375ec7562582fdf · Keenan Nemetz · 21h ago · parent 9103f6a8
docs-theme/assets/docs.js +44−3
| @@ -1,6 +1,7 @@ | |||
| 1 | /* The docs have two pieces of behaviour: a small-screen navigation drawer and | ||
| 2 | the search palette. Both are progressive: without this script the links and | ||
| 3 | page content still work, and the search button simply does nothing. */ | ||
| 1 | /* The docs have three pieces of behaviour: a small-screen navigation drawer, | ||
| 2 | the search palette, and Mermaid diagrams. All are progressive: without this | ||
| 3 | script the links and page content still work, and the search button simply | ||
| 4 | does nothing. */ | ||
| 4 | 5 | (() => { | |
| 5 | 6 | const body = document.body; | |
| 6 | 7 | ||
| @@ -46,6 +47,46 @@ | |||
| 46 | 47 | block.append(button); | |
| 47 | 48 | }); | |
| 48 | 49 | ||
| 50 | /* ---------- mermaid diagrams ---------- */ | ||
| 51 | |||
| 52 | /* Loaded only on pages with `mermaid: true` in their front matter. Mermaid | ||
| 53 | renders from the .mermaid elements after the DOM is parsed. */ | ||
| 54 | const renderMermaid = () => { | ||
| 55 | if (!window.mermaid || !document.querySelector('.mermaid')) return; | ||
| 56 | document.querySelectorAll('.mermaid[data-source]').forEach((element) => { | ||
| 57 | element.textContent = element.dataset.source; | ||
| 58 | }); | ||
| 59 | window.mermaid.initialize({ | ||
| 60 | startOnLoad: false, | ||
| 61 | securityLevel: 'strict', | ||
| 62 | theme: 'base', | ||
| 63 | fontFamily: 'Lexend, ui-sans-serif, system-ui, sans-serif', | ||
| 64 | themeVariables: { | ||
| 65 | background: '#2d353b', | ||
| 66 | primaryColor: '#343f44', | ||
| 67 | primaryTextColor: '#d3c6aa', | ||
| 68 | primaryBorderColor: '#4f585e', | ||
| 69 | secondaryColor: '#3d484d', | ||
| 70 | tertiaryColor: '#3d484d', | ||
| 71 | lineColor: '#9da9a0', | ||
| 72 | textColor: '#d3c6aa', | ||
| 73 | mainBkg: '#343f44', | ||
| 74 | nodeBorder: '#4f585e', | ||
| 75 | clusterBkg: '#2d353b', | ||
| 76 | clusterBorder: '#4f585e', | ||
| 77 | edgeLabelBackground: '#2d353b', | ||
| 78 | fontSize: '16px', | ||
| 79 | }, | ||
| 80 | }); | ||
| 81 | window.mermaid.run({ querySelector: '.mermaid' }); | ||
| 82 | }; | ||
| 83 | |||
| 84 | if (document.readyState === 'loading') { | ||
| 85 | document.addEventListener('DOMContentLoaded', renderMermaid); | ||
| 86 | } else { | ||
| 87 | renderMermaid(); | ||
| 88 | } | ||
| 89 | |||
| 49 | 90 | /* ---------- search palette ---------- */ | |
| 50 | 91 | ||
| 51 | 92 | const dialog = document.getElementById('search-palette'); | |