Zum Hauptinhalt springen
••••••••••••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Keep Your MkDocs Screenshots Up to Date (Material Theme)

You've got MkDocs with Material theme. Dark mode works. Code blocks adapt. But your screenshots? Still stuck in light mode. Here's how to fix that with…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!

You've got MkDocs with Material theme. Dark mode works. Code blocks adapt. But your screenshots? Still stuck in light mode.



Here's how to fix that with Heroshot - a CLI that captures screenshots and handles light/dark variants automatically.






Step 1: Install the CLI



Pick your preferred method:



curl (standalone binary):




curl -fsSL https://heroshot.sh/install.sh | sh






Homebrew:




brew install omachala/heroshot/heroshot






npm:




npm install -g heroshot






Docker:




docker pull heroshot/heroshot









Step 2: Install the Python package



The CLI captures screenshots. The Python package provides the MkDocs macro:




pip install heroshot









Step 3: Configure output directory



MkDocs serves from docs/. Create .heroshot/config.json:




{
"outputDirectory": "docs/heroshots"
}






Your structure:




my-project/
├── docs/
│ ├── index.md
│ └── heroshots/ # screenshots go here
├── mkdocs.yml
└── .heroshot/
└── config.json









Step 4: Capture screenshots



Start your MkDocs dev server:




mkdocs serve






In another terminal, run heroshot:




heroshot






(Or npx heroshot / docker run --rm -v $(pwd):/work heroshot/heroshot depending on install method)



A browser opens with a visual picker. Navigate to localhost:8000, click on elements you want to capture, name them. Close when done.



You'll get two files per screenshot:




  • dashboard-light.png

  • dashboard-dark.png






Step 5: Add the macro



Update your mkdocs.yml:




plugins:
- macros:
modules: [heroshot]






Use it in your markdown:




{{ heroshot("dashboard", "Dashboard overview") }}






The macro expands to Material's #only-light / #only-dark syntax. When readers toggle the theme, screenshots swap automatically.






Step 6: Keep them fresh



When your UI changes:




heroshot






All configured screenshots regenerate. No manual cropping, no file hunting.






Bonus: Screenshots without theme variants



For diagrams or architecture images that don't need dark mode:




{{ heroshot_single("architecture", "System architecture") }}






Renders a simple <img> tag.






Full docs: heroshot.sh/docs/integrations/mkdocs



Example repo: github.com/omachala/heroshot/tree/main/integrations/examples/mkdocs

🔍 CTI & Forensik

Cyber Threat Intelligence & Forensik

ATT&CK-Navigator · IoC-Radar · Exploit-Belege
🛡️
Exploit PoC Security Sandbox & Payload Analyzer TEXT
Danger Index:25/100 SAFE_ANALYSIS_ONLY
✅ Keine offensichtlich destruktiven Befehle erkannt.
Standard-Analystenprüfung vor Ausführung empfohlen.
Erkannte Gefahrensignaturen (1):
HIGHPAYLOAD_DROPPER:Download-and-Execute Dropper-Muster (Piped Shell-Execution).
curl -fsSL https://heroshot.sh/install.s
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Keep Your MkDocs Screenshots Up to Date (Material Theme)

Thematisch verwandte Begriffe: Keep, Your, MkDocs, Screenshots · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag