Publish Markdown to OpenArtifacts
Require one existing Markdown source file. When the user asks to delete, remove, or
withdraw its current OpenArtifacts page, do not generate HTML. Run the host wrapper with
only the vault-relative source-note path. Obsidian reads the note’s current identity
and opens its existing management modal; the user alone chooses Update or Delete.
Never tell the user to delete the page at its public URL.
For publishing or updating, finish a complete, self-contained,
passive HTML document before asking Obsidian to review it. Render source-specific
content such as Mermaid and Obsidian Bases into static HTML or SVG, embed images,
and include no scripts, frames, forms, handlers, redirects, or external assets. Treat
YAML frontmatter as note metadata: never render the raw frontmatter block as page
content. The exact UTF-8 HTML must not exceed 10485760 bytes.
Style the page from a theme file rather than improvising. Resolve the theme name in
this order: OPENARTIFACTS_THEME from the environment when set, then a theme the
user named in chat, then research-memo. Read
$OPENARTIFACTS_WORKSPACE_ROOT/.openartifacts/themes/<name>.md when the
user has authored that theme, otherwise themes/<name>.md next to this file. Follow
it exactly: tokens, type, scale, layout, components, and its theme-handling CSS, all
inlined. If neither file exists, still publish with restrained defaults (system fonts,
one accent, a readable measure, light and dark handled) and tell the user which theme
was not found.
Write those final bytes to a new unique .html file under
$OPENARTIFACTS_WORKSPACE_ROOT/.openartifacts/handoffs/, creating that
directory first when it does not exist. Do not show a prose substitute or ask
for confirmation in chat. Instead run the host wrapper with exactly two
vault-relative paths: the source note and the staged HTML.
On macOS or Linux:
sh "/absolute/path/to/this/skill/directory/openartifacts-publish.sh" "Notes/source.md" ".openartifacts/handoffs/unique.html"For withdrawal, omit the staged-HTML argument:
sh "/absolute/path/to/this/skill/directory/openartifacts-publish.sh" "Notes/source.md"On Windows, use the .cmd wrapper (prefix it with & in PowerShell):
& "/absolute/path/to/this/skill/directory/openartifacts-publish.cmd" "Notes/source.md" ".openartifacts/handoffs/unique.html"Omit the staged-HTML argument on Windows for withdrawal as well.
With only the source path, the wrapper blocks while Obsidian shows its host-owned
Update/Delete management modal. With a staged HTML path, it blocks while Obsidian
consumes the artifact and shows its source, title, and a link to a sandboxed
local-browser rendering of the exact captured page. Obsidian rejects active or
externally loaded content, prevents navigation from the browser preview, removes the
original artifact, removes its temporary browser preview after review, and alone reads
the current note identity to choose whether confirmation publishes or updates; never
choose an action or document id.
cancelled: stop. No request was sent.regenerate: create a new complete artifact and run the wrapper again. The
previous confirmation never applies to regenerated bytes.publishedorupdated: return the host-provided public URL verbatim.deleted: report that the host withdrew the page and removed its note identity.failed: if the host says to edit the staged file, address every listed issue in
that same file and retry exactly once. Otherwise, or if that retry fails, stop and
report the exact host message. Never invent a cause, change unrelated styling, create
another filename, bypass the review, or publish directly.