Feat/community template browser#529
Open
ObsidianTTRPGProject wants to merge 6 commits into
Open
Conversation
…install, local/remote registries)
…); keep layout on jsDelivr for download counts
…, gallery UI, jsDelivr download counts
Conflict resolutions: - src/main.ts: take upstream imports (parser/linkify, Bestiary); keep communityTemplates manager and communityTemplateSnippets default; adopt upstream atomicWrite:false; drop names/#creatures (moved to Bestiary) - src/settings/settings.ts: take upstream import block, keep BrowseModal import - src/settings/settings.css: keep both community-browser and loading-spinner blocks - src/typings/obsidian-extended.d.ts: move customCss typing here (declarations relocated from main.ts upstream) - src/community/*: fix 'types/layout' import to real path src/layouts/layout.types
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Community Template Browser
Adds an in-app browser for installing community-contributed statblock layouts, so users can theme creatures for systems beyond the built-in D&D 5e and Pathfinder 2e support without hand-editing JSON or hunting for CSS snippets.
Motivation
Fantasy Statblocks ships great 5e/PF2e layouts, but support for other systems (OSR, sci-fi horror, etc.) has always meant manually importing someone's exported layout JSON and, for themed cards, manually installing a CSS snippet. This PR turns that into a one-click experience backed by a public, PR-driven registry.
What's included
Statblock Templates/folder so the in-note format is immediately visible.How it works
The registry is a separate GitHub repo (
Obsidian-TTRPG-Community/fantasy-statblocks-templates) with anindex.jsonmanifest listing each template'slayout,example,css,preview, and metadata.Asset fetching is split deliberately:
raw.githubusercontent.comso author edits reach users immediately — no CDN cache lag and no cold-start.All network access uses Obsidian's
requestUrl(no CORS issues) and degrades gracefully — download stats and previews fall back silently when unavailable.CSS theming
Templates may ship a CSS snippet that re-themes their layout. On install it's written to
.obsidian/snippets/and enabled automatically; it's tracked against the installed layout id and disabled/cleaned up if that layout is later removed. Snippets are expected to scope their rules to the layout's auto-generated container class (e.g..mrk-borg-creature) so they only affect their own layout, and may embed textures/fonts as base64 data URIs to stay self-contained.Safety & privacy
javascriptblocks; previewing or installing one shows a confirmation prompt first.Files
src/community/types.ts— manifest schema, registry constants, layout validation, JS-block scan, snippet naming. (new)src/community/manager.ts— all registry network access (manifest, layout, example, CSS, download stats); raw-vs-CDN URL resolution. (new)src/community/BrowseModal.ts— gallery + detail modal, live preview, CSS injection, install flow. (new)src/main.ts—CommunityTemplateManagerinstance,customCsstyping, default settings.index.ts—communityTemplateSnippetssettings field.src/settings/settings.ts— Browse button and snippet cleanup on layout removal.src/settings/settings.css— modal/gallery/tile/detail styles.src/view/statblock.ts— honor an explicitly-passed layout so not-yet-installed templates can be previewed.community-templates/— bundled copy of the registry (manifest, example templates, docs).Testing
Notes / follow-ups
statblockformat.