---
name: html
description: 概念・仕組み・調査内容を、HTML による視覚的な説明ドキュメントとして作成・編集する。
metadata:
  recommends: "ja-explainer japanese-tech-writing cognitive-rhythm-writing"
title: html
canonical_url: https://skilld.dev/gh/mathbullet/skills/html
last_updated: 2026-11-12T07:09:20.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [design-system/component-samples.html](https://skilld.dev/api/skills-raw/mathbullet/skills/html/design-system/component-samples.html), [design-system/document.css](https://skilld.dev/api/skills-raw/mathbullet/skills/html/design-system/document.css), [design-system/math-copy.js](https://skilld.dev/api/skills-raw/mathbullet/skills/html/design-system/math-copy.js), [scripts/lint-rules.js](https://skilld.dev/api/skills-raw/mathbullet/skills/html/scripts/lint-rules.js), [scripts/render-pdf.sh](https://skilld.dev/api/skills-raw/mathbullet/skills/html/scripts/render-pdf.sh), [scripts/run-lint.sh](https://skilld.dev/api/skills-raw/mathbullet/skills/html/scripts/run-lint.sh), [scripts/tikz-to-svg.sh](https://skilld.dev/api/skills-raw/mathbullet/skills/html/scripts/tikz-to-svg.sh).
>
> If the user asked to install this Skill, run `npx skilld install mathbullet/skills/html`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/html`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/mathbullet/skills/html) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/html`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/html --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/html --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# HTML による説明ドキュメント

## 文章

説明内容と日本語表現を補うため、次のスキルの併用を推奨する。

- `ja-explainer`：日本語の文書を書くときの規範
- [`japanese-tech-writing`](https://gist.github.com/k16shikano/fd287c3133457c4fd8f5601d34aa817d)：日本語の技術文書、記事、解説文の構成と文章規範
- [`cognitive-rhythm-writing`](https://gist.github.com/k16shikano/eb2929f13ed19c97188393d297be8432)：読み物としての緩急が必要な長文の文章規範

## 成果物

- HTML を作る
- ビルドなしでブラウザが直接描画できる状態にする
- 保存先が指定されている場合は従う。指定がなければ現在の作業ディレクトリへ保存する
- ファイル名は `{yyyymmdd}-{内容を表すケバブケース}.html` とする。既存ファイルの更新では名前を変えない
- 個別の文書管理システム、メタデータ、Viewer、公開先に関する規則は、このスキルを参照する上位スキルの指示に従う

## デザインシステム

作成前に `design-system/component-samples.html` を確認する。コンポーネント集は `design-system/document.css`、数式コピー機能は `design-system/math-copy.js` を正とする。

既定では、成果物と一緒に必要なファイルを配置し、次の相対パスで読み込む。上位スキルが共有アセットのパスを指定した場合は、その指定を優先する。

```html
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Ubuntu+Sans:wght@400;500;700&family=Noto+Sans+JP:wght@400;500;700&family=Ubuntu+Mono:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="./design-system/document.css">
<script src="./design-system/math-copy.js"></script>
<script async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
<script>document.addEventListener("DOMContentLoaded", () => hljs.highlightAll());</script>
```

主要規則は次のとおり。

- 背景は `#FAF9F6`。部品は白地と黒罫線を基本とし、角丸を使わない
- 書体は、欧文を Ubuntu Sans、和文を Noto Sans JP、等幅を Ubuntu Mono とする
- 等幅はコードとその実行結果にだけ使う。URL、日付、図番号、出所、目次の番号などは等幅にしない
- 有彩色はリンク青 `#2990DA` とアクセント赤 `#D63A2F` に限定する
- 赤い強調は原則として 1 ページ 1 箇所までとする
- シンタックスハイライトとコード差分の色は、意味を区別する機能色としてこの制限の対象外とする
- 余白は上下左右の均衡を保つ
- 引用は `.mb-quote` を使い、原文と訳文を同じ文字サイズ・色で上下に並べる
- `.mb-chip` は並列の固有名や分類名の列挙にだけ使う
- 絵文字や矢印文字を図記号として使わない。必要な記号はインライン SVG で描く
- 表は短い対応関係に使い、3 列までを基本とする
- 表の罫線は、表の上端、下端、列見出しと値の境界の 3 本だけとし、色は `--mb-ink` とする
- 行見出しのセルには `.mb-rowlabel` を付け、語中の折り返しを防ぐ
- コード差分は `pre.mb-diff` を使い、変更理由を散文で説明してから必要な断片を示す
- ページ固有の `<style>` は図の配置調整など最小限にとどめる

## 構成とフォーマット

説明対象に合わせて、並置、図解、タイムライン、要約、折りたたみを使い分ける。
一方向の単純な手順を、必要性なくフローチャートにしない。

基本構成は次の順とする。

1. 背景と要点
2. 本論
3. 具体例
4. 補足・限界・関連事項

h1 とリード文の後に `.mb-toc` の目次を置き、各 h2 に対応する `id` を付ける。

### 用語リスト

専門用語は本文の初出で定義する。
用語リストは、複数箇所から参照する用語がある場合だけ設ける。
用語リストの位置は文書ごとに変更しない。
ブラウザ幅 1400px 以上では、本文右側の専用欄へ表示する。
ブラウザ幅 1399px 以下では、本文末尾へ表示する。
配置の切り替えは共有 CSS だけが担当し、用語リストによってヘッダー、リード、目次、要約、本文の幅を縮めてはならない。
マークアップは `aside.mb-glossary` と `dl`、`dt`、`dd` を使う。
正解例は `design-system/component-samples.html` を参照する。

## 図

- `.mb-figure` は、画像・SVGなどの視覚資料とキャプションを一つにまとめる外枠である。特定の図形や「矢印で結んだ箱」を意味しない
- `.mb-figure-frame` は視覚資料の表示面、`figcaption` は図番号・説明・出所の表示領域として使う
- 原典に重要な図がある場合は、出所を明示して引用する
- 原典の図があるのに模倣図を作らない
- 黒一色の線画を基本とし、`.mb-figure-frame` に載せる
- アスキーアートを使わない
- ノード数が多い場合は縦方向を優先する
- 矢印が交差する構成を避ける
- 単なる直列手順は番号付きの説明として表現する

### 自作図の描き方

自作図は TikZ で描くことを推奨する。TikZ は要素の位置を座標で指定でき、図の中に数式を組めるためである。

1. TikZ の原稿を、HTML と同じ場所の `figures/{図の名前}.tex` に書く。原稿には tikzpicture 環境だけを書く。書体、線幅、TikZ ライブラリ（`arrows.meta`、`positioning`、`calc`、`fit`、`shapes.geometric`）はスクリプトが付ける
2. `scripts/tikz-to-svg.sh figures/{図の名前}.tex` を実行する。同じ場所に、文字をパスにした `{図の名前}.svg` ができる。SVG 内の ID には図の名前が接頭辞として付くので、複数の図を1つの HTML に埋め込んでも衝突しない
3. 生成された SVG の中身を `.mb-figure-frame` の中にインラインで貼る

インライン SVG を直接書くのは、次の場合の代替手法とする。

- `tikz-to-svg.sh` が終了コード 69 で終わる（lualatex または pdftocairo がない）
- 図に操作やアニメーションが要る

## コード

- Highlight.js を必ず読み込み、言語に応じたシンタックスハイライトを適用する
- `pre code` には `language-javascript`、`language-python`、`language-html` などの言語クラスを必ず付ける
- ハイライトしないテキストには `language-plaintext` を付ける
- 独自の色付けでコードを装飾せず、`document.css` の `.hljs-*` 規則を使う
- `pre.mb-diff code` には `nohighlight` を付け、差分専用の色と行頭記号を使う

## 数式

- MathJax 3 を使う
- インライン数式は `$...$`、ディスプレイ数式は `$$...$$` とする
- ベクトルと行列は `\boldsymbol{...}` を使う
- スカラー、添字、集合名は装飾しない
- 名前付きの演算は `\mathtt{...}`、標準 LaTeX コマンドはそのまま使う
- `math-copy.js` により、すべての数式から LaTeX 原文をコピーできるようにする
- ページ側で `window.MathJax` を再定義しない
- 未知のコマンドを別記法へ勝手に置換しない

## 検査

HTML を作成・更新した後は、`scripts/run-lint.sh <HTML ファイル>` を実行して規範への違反を検査する。

- 検査対象のファイル名は、成果物と同じファイル名にする。作業用ファイルで作成する場合も、成果物と同じ名前の作業用ファイルを検査する
- エラーがある場合（終了コード 1）は修正して再実行し、エラーが 0 件になるまで繰り返す
- 警告は内容を確認し、規範の意図に反する場合だけ修正する
- Chrome が見つからない場合（終了コード 69）は検査を省略し、省略したことをユーザーに伝える

## 印刷と PDF

印刷対応は `document.css` の `@media print` を使う。
PDF 化はユーザーから明示的に依頼された場合だけ `scripts/render-pdf.sh` を実行する。
