Skip to content

Commit a85e8cd

Browse files
committed
docs: Add HTML authoring skill release artifact
1 parent 97e1fbe commit a85e8cd

6 files changed

Lines changed: 81 additions & 14 deletions

File tree

.agents/SKILL.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
---
22
name: obsidian-html-docs
3-
description: Author HTML files for the Obsidian HTML Docs plugin (smcllns/obsidian-plugin-html-docs). Use when creating .html docs intended to render inline in Obsidian — covers the context the plugin provides, sandbox constraints, asset rules, and the things that silently don't work.
3+
description: Author HTML files for the Obsidian HTML Docs plugin (smcllns/obsidian-plugin-html-docs). Use when creating .html docs intended to render inline in Obsidian: theme tokens, sandbox constraints, asset rules, embed sizing, and things that silently do not work.
44
---
55

6-
# Obsidian HTML Docs authoring guide
6+
# Obsidian HTML Docs authoring guide
77

8-
The plugin enables the user to view html files inside Obsidian, similar to md files. The plugin renders `.html` in a sandboxed iframe via Blob URL. The iframe is sealed (`sandbox="allow-scripts allow-popups allow-forms"`, no `allow-same-origin`) so it can't reach into Obsidian or the vault. Everything below works within that envelope.
8+
The HTML Docs plugin lets users view `.html` files inside Obsidian tabs, markdown embeds, and Canvas cards. It renders each file in a sandboxed iframe via Blob URL. The iframe is sealed (`sandbox="allow-scripts allow-popups allow-forms"`, no `allow-same-origin`) so it cannot reach into Obsidian or the vault. Everything below works within that envelope.
99

10-
## Default to Obsidian's context unless asked otherwise
10+
## Default to Obsidian context unless asked otherwise
1111

12-
Before sealing the iframe, the plugin can prepend a `<style>` block to your HTML containing a snapshot of the user's current Obsidian design tokens. The iframe doesn't reach out for these values — they're written as static CSS into your document at load time, then the sandbox is applied. **Security boundary unchanged** (no `allow-same-origin`, no reads from the iframe back into Obsidian); the iframe just has a few extra CSS variables declared in its own document.
12+
Before creating the Blob URL, the plugin appends a `<style data-html-docs-theme>` block to your HTML containing a snapshot of the user's current Obsidian design tokens. The iframe does not reach out for these values. They are written as static CSS into your document at load time, then the sandboxed iframe loads that document. **Security boundary unchanged**: no `allow-same-origin`, no reads from the iframe back into Obsidian.
1313

1414
If the user just wants a styled doc that "fits" their vault, use these as your defaults. If they're asking for a specific aesthetic (brutalist poster, retro terminal, Linear-style, an exact brand palette), design freely — Obsidian context is a *hint*, not a constraint.
1515

16-
**Injected as static CSS** (proposed plugin enhancement; today only `color-scheme: light dark` via OS preference works):
16+
Injected as static CSS:
1717

1818
- A `color-scheme: light | dark` declaration matching the user's current Obsidian theme
19-
- A small set of `--obsidian-*` CSS variables holding snapshot values from the user's active Obsidian theme: `--obsidian-bg`, `--obsidian-bg-2`, `--obsidian-text`, `--obsidian-text-muted`, `--obsidian-accent`, `--obsidian-border`, `--obsidian-font`, `--obsidian-font-mono`
20-
21-
**Graceful pattern** — use Obsidian tokens if present, fall back if not:
19+
- `--obsidian-color-scheme`
20+
- `--obsidian-bg`
21+
- `--obsidian-bg-2`
22+
- `--obsidian-text`
23+
- `--obsidian-text-muted`
24+
- `--obsidian-accent`
25+
- `--obsidian-border`
26+
- `--obsidian-font`
27+
- `--obsidian-font-mono`
28+
29+
Use Obsidian tokens if present, fall back if not:
2230

2331
```css
2432
:root {
@@ -28,9 +36,9 @@ If the user just wants a styled doc that "fits" their vault, use these as your d
2836
}
2937
```
3038

31-
Today this CSS already follows OS light/dark via `prefers-color-scheme`. Once the plugin ships theme injection, the snapshot reflects the user's exact Obsidian theme — including custom themes and snippets — and your variable fallbacks resolve to those values automatically. No code change needed on the HTML side.
39+
Open HTML tabs and embeds re-render when the Obsidian theme changes, so the injected snapshot follows theme switches.
3240

33-
## Assetsvault paths do NOT cross into the iframe
41+
## Assets: vault paths do not cross into the iframe
3442

3543
The iframe has no base URL pointing into the vault. Obsidian themes, snippets, and `attachments/...` images don't reach the iframe.
3644

@@ -80,15 +88,15 @@ See: [[my-doc.html]]
8088
## Embed sizing
8189

8290
```markdown
83-
![[doc.html|width=600 height=400]]
91+
![[doc.html|600x400]]
8492
```
8593

86-
Sets `--html-docs-width` / `--html-docs-height` on the embed container. Default embed height is ~600px; tab views fill the pane.
94+
Sets the embed width and height. Default markdown embed height is about 600px; tab views fill the pane.
8795

8896
## Pitfalls (skip the turn cost)
8997

9098
- **Theme scripts that read `window.parent`** — always throw under this plugin's sandbox. Don't write them.
9199
- **Images via `attachments/foo.png`** — won't resolve. Inline as data URL or use HTTPS.
92100
- **`localStorage` / cookies for state** — blocked. Use URL hash or postMessage to parent.
93101
- **Hard-coding a palette when Obsidian tokens are available** — defeats the contextual fit. Use `var(--obsidian-*)` with `light-dark()` fallbacks.
94-
- **Assuming `prefers-color-scheme` == Obsidian theme**usually true, sometimes not. Once the plugin ships theme injection, this is fully resolved.
102+
- **Assuming `prefers-color-scheme` == Obsidian theme**use `--obsidian-color-scheme` or injected colors instead.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# HTML Docs authoring skill release
2+
3+
Scope:
4+
- [x] Sync `main` to merged PR #8.
5+
- [x] Rebase PR #7 branch onto theme-token work.
6+
- [x] Update canonical `.agents/SKILL.md` for real theme-token injection.
7+
- [x] Bundle `SKILL.md` into `dist/html-docs/` during build.
8+
- [x] Include bundled `SKILL.md` in release upload/provenance.
9+
- [x] Clarify README optional agent-skill install/discovery.
10+
- [x] Mirror skill to `smcllns/skills`.
11+
- [x] Run build/lint/test checks.
12+
- [ ] Push PR branches.
13+
14+
Decisions:
15+
- Plugin repo is canonical source.
16+
- `smcllns/skills` is the installable mirror.
17+
- Obsidian plugin install does not install agent skills.
18+
- Plugin runtime must not write to `~/.claude`, `~/.agents`, `~/.codex`, or dotfiles.
19+
20+
Unresolved questions:
21+
- None.

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
subject-path: |
3939
dist/html-docs/main.js
4040
dist/html-docs/manifest.json
41+
dist/html-docs/SKILL.md
4142
dist/html-docs/styles.css
4243
4344
- name: Create GitHub Release
@@ -50,4 +51,5 @@ jobs:
5051
--generate-notes \
5152
dist/html-docs/main.js \
5253
dist/html-docs/manifest.json \
54+
dist/html-docs/SKILL.md \
5355
dist/html-docs/styles.css

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ A demo page (`test/fixture.html`) demonstrates all the passing HTML features.
3030

3131
Releases are built and signed by GitHub Actions ([.github/workflows/release.yml](.github/workflows/release.yml)) so the binaries carry a [build attestation](https://docs.github.com/en/actions/security-for-github-actions/using-artifact-attestations/using-artifact-attestations-to-establish-provenance-for-builds) you can verify against the source.
3232

33+
### Optional agent authoring skill
34+
35+
The plugin repo keeps the canonical source skill at `.agents/SKILL.md`, and releases include the same file as `dist/html-docs/SKILL.md` for reference. That file teaches agents how to author HTML that fits the plugin's sandbox, theme tokens, asset rules, and embed behavior.
36+
37+
Installing or updating the Obsidian plugin does **not** automatically install an agent skill. Claude, Codex, and other agents discover skills from their own configured roots, not from `<vault>/.obsidian/plugins/html-docs/`. The installable mirror lives in [smcllns/skills](https://github.com/smcllns/skills) as `obsidian-html-docs`; install it with your agent's normal skill installer, or ask your agent to read the bundled `SKILL.md` and integrate the guidance into your workflow.
38+
3339
### Build and install from source
3440

3541
```bash
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Authoring Skill Release Handoff
2+
3+
Goal:
4+
- Finish PR #7 as a small follow-up to merged PR #8.
5+
- Make the HTML authoring skill useful after theme-token injection shipped.
6+
- Be honest that Obsidian plugin installs do not activate agent skills.
7+
8+
Implemented shape:
9+
- `.agents/SKILL.md` is the canonical source copy in this plugin repo.
10+
- `esbuild.config.mjs` copies `.agents/SKILL.md` to `dist/html-docs/SKILL.md`.
11+
- The release workflow uploads and attests `dist/html-docs/SKILL.md` alongside runtime files.
12+
- README has an optional agent-skill note explaining discovery roots and the `smcllns/skills` mirror.
13+
- `/Users/smcllns/Projects/agent-skills/skills/obsidian-html-docs/SKILL.md` mirrors the canonical skill.
14+
15+
Important constraint:
16+
- Plugin runtime must not write to `~/.claude`, `~/.agents`, `~/.codex`, dotfiles, or any other agent install root. Agent skill activation belongs to the user's agent tooling, not the Obsidian plugin.
17+
18+
Verification target:
19+
- `bun run build`
20+
- `bun run lint`
21+
- `bun run test`
22+
- Confirm `dist/html-docs/SKILL.md` matches `.agents/SKILL.md`.
23+
24+
Current verification:
25+
- `bun run build` passed.
26+
- `bun run lint` passed.
27+
- `bun run test` passed against live Obsidian.
28+
- `.agents/SKILL.md`, generated `dist/html-docs/SKILL.md`, and the `smcllns/skills` mirror match.
29+
- Haiku critical review found one stale `light-dark()` wording mismatch; fixed by keeping `light-dark()` in the supported CSS list.

esbuild.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const distDir = path.join("dist", "html-docs");
1616
fs.mkdirSync(distDir, { recursive: true });
1717
fs.copyFileSync("manifest.json", path.join(distDir, "manifest.json"));
1818
fs.copyFileSync("styles.css", path.join(distDir, "styles.css"));
19+
fs.copyFileSync(path.join(".agents", "SKILL.md"), path.join(distDir, "SKILL.md"));
1920

2021
const context = await esbuild.context({
2122
banner: { js: banner },

0 commit comments

Comments
 (0)