--- name: david888-wiki-publisher description: Publish, read, and append markdown content directly to the David888 Wiki using its REST API. Use when asked to write a report, save text, upload images, or read from wiki.david888.com. --- # David888 Wiki Publisher Skill You have the ability to read, write, and append markdown content natively to `wiki.david888.com` using HTTP requests (cURL or Python requests). **API Base URL**: `https://wiki.david888.com/api` ## Mandatory Freshness Check Before every invocation of this skill, fetch and read the latest complete skill document from the canonical website URL. Do not assume a local, repository, or previously cached copy is current. ```bash curl -fsSL -H "Cache-Control: no-cache" \ "https://wiki.david888.com/.well-known/agent-skills/david888-wiki-publisher/SKILL.md" ``` Apply the fetched version's instructions for the rest of the task. If the canonical URL is temporarily unavailable, only use a local or cached copy as a fallback, clearly note that freshness could not be verified, and avoid assuming that undocumented behavior is supported. ## Quick Start Guide ### 1. Read a Wiki Page (GET) ```bash curl -X GET "https://wiki.david888.com/api/" ``` *If protected, use `?pw=` or `Authorization: Bearer `.* ### 1.1 Read Markdown Instead of Rendered HTML If you are reading a normal note page or a public share page, do not scrape the rendered HTML first. Ask the server for markdown directly. ```bash curl -X GET "https://wiki.david888.com/share/" \ -H "Accept: text/markdown" ``` You can use the same header on `https://wiki.david888.com/`. Reading priority for agents: 1. Prefer `GET /api/` when you know the note path. 2. Otherwise use `GET /share/` with `Accept: text/markdown`. 3. Only fall back to HTML parsing when markdown negotiation is unavailable. ### 2. Create/Overwrite a Page (POST) ```bash curl -X POST "https://wiki.david888.com/api/" \ -H "Content-Type: application/json" \ -d '{ "text": "# Title\nContent", "public": true, "theme": "retro" }' ``` ### 2.1 Upload a Full Markdown File Directly If you already have a local `.md` file, prefer raw markdown upload instead of embedding the whole document inside JSON. ```bash curl -X POST "https://wiki.david888.com/api/?public=true&theme=retro" \ -H "Content-Type: text/markdown; charset=UTF-8" \ --data-binary @article.md ``` This is safer for long markdown because it avoids JSON escaping problems. ### 2.2 Multipart Markdown File Upload ```bash curl -X POST "https://wiki.david888.com/api/" \ -F "file=@article.md;type=text/markdown" \ -F "public=true" \ -F "theme=retro" ``` Use form fields `append`, `public`, `share`, `theme`, `pw`, and `vpw` when needed. ### 2.3 Available Themes Choose a theme to wow the user: `ayu-light`, `bauhaus`, `botanical`, `catppuccin-latte`, `catppuccin-macchiato`, `claude-canvas`, `green-simple`, `kanagawa`, `neo-brutalism`, `newsprint`, `notion-clean`, `organic`, `playful-geometric`, `professional`, `retro`, `shopify-mint`, `sketch`, `terminal`, `tokyo-night`, `x-ai`. > [!IMPORTANT] > **CRITICAL: READ THE RESPONSE CAREFULLY!** > The response contains TWO URLs: > 1. `url`: This is the **internal edit URL**. It always points to the same path. **DO NOT GIVE THIS TO THE USER.** > 2. `shareUrl`: This is the **public read-only URL**. It uses a hash (e.g., `/share/abc123`). > > **YOU MUST ALWAYS GIVE THE `shareUrl` TO THE USER.** If you give the `url`, the user will likely see an empty or error page. > > If the content is intended to be viewed as slides, you may also derive a presentation link by appending `/present` to `shareUrl`. > Example: `https://wiki.david888.com/share/abc123/present#/2` > Use the Reveal hash suffix to point to a specific slide when useful. ### 2.4 Note Settings Route (Browser/Edit Session) There is also a note settings route for the normal editor: ```bash curl -X POST "https://wiki.david888.com//setting" \ -H "Content-Type: application/json" \ -H "Cookie: auth=" \ -d '{ "theme": "retro", "width": "1200px", "shareFont": "jetbrains", "previewDevice": "desktop", "publicIndex": false }' ``` Important: - This route uses the normal edit-session cookie flow, not the note API password flow. - Use it when an agent is operating inside the authenticated editor/browser context. - For headless publishing, prefer `POST /api/` first, then only use `/:path/setting` if you truly need persisted UI settings such as width or share font. Supported JSON fields on `POST /:path/setting`: - `mode`: note mode metadata - `share`: whether the note has a public share link - `theme`: persisted theme name - `width`: preview/share width metadata - `shareFont`: `jetbrains` or `maple` - `previewDevice`: `desktop` or `mobile` - `publicIndex`: whether the shared note should be included in `/sitemap.xml` If `share` is set to `false`, `publicIndex` is automatically forced to `false`. ### 3. Append to a Page (POST) ```bash curl -X POST "https://wiki.david888.com/api/" \ -H "Content-Type: application/json" \ -d '{ "text": "\n\n## Update\n...", "append": true }' ``` If appending from a local markdown file, use: ```bash curl -X POST "https://wiki.david888.com/api/?append=true" \ -H "Content-Type: text/markdown; charset=UTF-8" \ --data-binary @update.md ``` ## Common Scenarios & Templates ### A. Saving a Research Report **Action**: Create a new path (e.g., `report-2024-03`) and POST the content. **Prompt for self**: "I will save this report to the wiki at path `report-2024-03` so the user can share it." ### A.1 Large Context / Skill Files If the material is a long source document such as `SKILL.md`, API docs, logs, or raw context exports, do **not** paste the full file into the wiki by default. Use this pattern instead: - Write a concise summary of the important points. - Include the original repo path, local path, or canonical URL. - Only publish the full raw text when the human explicitly asks for a full mirror/copy. Example: ```md # Skill Summary - Purpose: publish markdown to the wiki API - Key rule: return `shareUrl`, not `url` # Source - Repo path: `skills/SKILL.md` ``` ### B. Appending to a Task Log **Action**: Use `append: true` to avoid reading large history. **Prompt for self**: "I'll append this status update to the `task-log` instead of overwriting." ### C. Handling Local Images 1. **Upload**: `curl -X POST "https://wiki.david888.com/api/upload" -F "image=@/local/path.png"` 2. **Replace**: Extract the returned URL and replace `/local/path.png` in your markdown. 3. **Publish**: POST the final markdown. ### D. Writing Mermaid and Flow Diagrams Use fenced code blocks with language `mermaid`. Prefer standard Mermaid syntax and keep node labels plain. ````md ```mermaid flowchart TD A[Start] --> B{Need share URL?} B -->|Yes| C[Return shareUrl] B -->|No| D[Keep editing] ``` ```` Practical rules: - Prefer `flowchart TD` or `flowchart LR` for process diagrams. - Keep one diagram per code fence. - Avoid wrapping Mermaid inside HTML blocks. - Use short node labels when possible, especially for mixed CJK and English text. - When the user asks for a flowchart, sequence diagram, state diagram, gantt chart, or mindmap, emit Mermaid markdown directly unless they explicitly ask for an image. ### E. Appearance Settings and Allowed Values When an agent needs to preserve the reader/editor presentation, use these persisted metadata values: - `theme`: one of the bundled theme names listed above - `width`: `100%`, `960px`, `1200px`, or `1440px` - `shareFont`: `jetbrains` or `maple` - `jetbrains` = JetBrains Mono - `maple` = Maple Mono - `previewDevice`: `desktop` or `mobile` - `publicIndex`: `true` or `false` Practical guidance: - Use `width: "100%"` when the user does not specify a reading width. - Use `shareFont: "jetbrains"` as the default shared-reader font. - Use `previewDevice: "mobile"` only when the human explicitly wants a phone-oriented preview state saved with the note. - If you are only publishing content and do not need to control note appearance, you can omit all of these fields. ### F. Writing Presentation Slides Presentation mode is available at `shareUrl + '/present'`. Authoring rules: - Use `---` to split slides. - Use `::left::` and `::right::` for a two-column slide. - Use `{v-click}` for progressive reveal items. Example: ````md # Product Update --- ::left:: ## What changed - API publishing - Share settings ::right:: ```mermaid flowchart TD A[Draft] --> B[Publish] B --> C[Share] ``` --- ## Rollout - {v-click} Deploy worker - {v-click} Verify share URL - {v-click} Confirm sitemap state ```` If the user asks for slides, prefer slide-oriented markdown instead of a flat long article. ## Editor Features and Operational Tips The wiki also includes a browser-based Markdown editor. When helping a user author a note, these features are available: - **Markdown toolbar**: headings, bold, italic, strikethrough, links, blockquotes, unordered/ordered/task lists, **Inline code**, fenced code blocks, horizontal rules, tables, image insertion, attachment upload, fullscreen editing, Undo / Redo, and AI formatting. Toolbar labels and inserted placeholders follow the selected interface language. - **Image Insertion**: the toolbar image button opens a file picker. With R2 enabled, the image is uploaded and a Markdown image URL is inserted automatically. Without R2, an editable Markdown image placeholder is inserted. - **888box Attachment Uploads**: the toolbar attachment button uploads videos, audio, documents, archives, and generic files to `box.david888.com`, falling back to `box.aiurl.tw` and then `box.glsoft.ai`. The editor inserts `