What:新增 html-export 與 html-style 兩支技能、tools/html-render.sh 與 tools/html-style.sh 兩支工具,以及六種版型乘五種風格的 HTML 範本。 Why:wiki 頁與議題要拿給 Gitea 以外的人看時,只能複製 markdown;不同類型的文件也該有各自的版面,不是每份都長一樣。 How:版型(report、slide、dashboard、spec、timeline、onepager)決定內容怎麼排,風格(minimal、corporate、dark、print、vivid)決定看起來長怎樣,兩者自由搭配。哪一種頁面套哪一組由設定決定:專案的 .jsc/html-styles 優先,其次 $JSC_HOME/html-styles.conf,對不到退 DEFAULT,再對不到才用內建的 report/minimal。產出是單一 HTML 檔,CSS 與腳本全部內嵌。 Who:需要把 wiki 頁或議題寄給客戶、主管或跨團隊同事的人。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4.0 KiB
name: html-export description: Export one Gitea wiki page or issue as a single self-contained HTML file. Parse the link with tools/gitea-link.sh, resolve that kind's layout and style through tools/html-style.sh (kind, then DEFAULT, then the built-in report/minimal), then render with tools/html-render.sh, which puts the markdown through Gitea's own renderer and inlines every asset. A request without a wiki or issue link stops the skill immediately: never guess the repository, the page or the issue number. Use when a page or issue has to leave Gitea as a document; not for choosing which template a kind uses - that is jsc-gitea:html-style.
html-export — a wiki page or issue becomes one HTML file
The link is the only input. The output is one file that opens anywhere, with no external asset.
Steps
-
Link gate. Run
tools/gitea-link.sh parse {url}. Exit 3 or no link in the request: stop and report it. Never fall back to the working directory's remote or to a page name the user mentioned in passing. Completion condition:kindiswikiorissue, andrepopluspageorindexare known. -
Work out the kind key — it decides which template applies:
- wiki page →
WIKI:{prefix}, where the prefix is the page name up to the first underscore (ANALYZE_D3F1A2B0→WIKI:ANALYZE; a page with no underscore uses the whole name). - issue → run
tools/issue.sh labels-of {repo} {index}and tryISSUE:{label}for each label in order; the first onetools/html-style.sh getanswers with sourceprojectorglobalwins. No label matches: useISSUE:DEFAULT.
Completion condition: exactly one kind key is chosen, and you can say which label or prefix produced it.
- wiki page →
-
Run
tools/html-style.sh get {key}. It always printslayout<TAB>style<TAB>source. Read the third column and report it:projectorglobalmeans the user configured this kind;defaultmeans it fell back to the DEFAULT row;builtinmeans nothing is configured at all andreport/minimalwas used. Fordefaultandbuiltin, tell the user in one line thatjsc-gitea:html-stylecan set this kind's own template. Completion condition: layout, style and source are reported before anything is rendered. -
Fetch the content:
jsc-gitea:wikiwiki-getfor a page, ortools/issue.sh titleplustools/issue.sh bodyfor an issue. Exit 4 (page missing) or an API failure stops the skill with the page name or issue number in the report. Completion condition: the markdown and the document title are in hand. -
Prepare the markdown — this step MUST run as a sub agent. Convert
[[display|page]]wiki links to absolute URLs fromwiki-url; the renderer does not resolve them, so they would ship as literal brackets. Strip personal data — an exported file travels further than the page it came from. Leave everything else exactly as written; this step never rewrites the content. Completion condition: no[[...]]remains, and the diff against the source is limited to link conversion and personal-data removal. -
Ask per
jsc-ask:askrules where the file goes, proposing./.jsc/html/{page-or-issue}.html. State the impact scope: a path inside a repository gets committed unless it is ignored. Completion condition: the user has confirmed one output path. -
Render:
tools/html-render.sh --markdown {file} --title {title} --layout {layout} --style {style} --source-url {absolute URL} --out {path}. Exit 1 means Gitea's renderer failed — report it and stop, with no half-rendered file left behind. Completion condition: the file exists, and the report names its path, the layout, the style and where that pair came from.
Rules
- One link, one file. Batch export is a loop the caller runs, not something this skill decides on its own.
- The rendered file inlines CSS and scripts on purpose: it is usually sent to someone outside Gitea, and an external asset breaks on their machine.
- The layout and style are never chosen by inspecting the content. The configuration decides, and
jsc-gitea:html-styleowns the configuration.