Repository navigation
feat(skills): add github-markdown skill #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8e3501c
feat(skills): add github-markdown skill for GitHub-only Markdown
claude daf4ed5
docs(skills): base github-markdown's HTML reference on html-pipeline'…
claude 8e2df9d
fix(skills): bump github-markdown to 0.1.1 for the html.md update
claude e659195
docs(skills): github-markdown: references need the target to exist first
claude 1152b60
fix(skills): github-markdown: one closing keyword covers a comma list
claude 25eaa7f
docs(skills): github-markdown: prefixed refs don't link; spaced comma…
claude 2bec877
docs(skills): github-markdown: keywords in a PR's commits count too
claude e540289
docs(skills): github-markdown: prefer visible line breaks and explici…
claude 1e445fe
docs(skills): github-markdown: no-JavaScript summary and floating images
claude 7ddea57
feat(skills): github-markdown: add fancy-tricks reference
claude 81afc6e
fix(skills): github-markdown: colorbox is blocked; mark tint differs …
claude 0cd989e
fix(skills): github-markdown: id works as a link target too
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| name: github-markdown | ||
| description: 'Use only when a GitHub-specific Markdown question comes up, usually while editing a repo''s root README.md, an issue or PR template, or an issue, PR or comment body: alerts, footnotes, task lists, heading anchors, #123 and SHA autolinks, @mentions, closing keywords, <details>, <picture> for dark mode, raw HTML that GitHub strips, Mermaid, math. Not needed for plain Markdown.' | ||
| metadata: | ||
| version: "0.2.2" | ||
| --- | ||
|
|
||
| # GitHub Markdown | ||
|
|
||
| Plain CommonMark is assumed knowledge. This covers only what github.com adds or changes. | ||
|
|
||
| ## GFM or plain Markdown? | ||
|
|
||
| Go down the list and stop at the first match: | ||
|
|
||
| 1. The user, AGENTS.md or CLAUDE.md says which to use: do that. | ||
| 2. The repo's root `README.md`: use GitHub features where they help. | ||
| 3. Text shown only on github.com (issue and PR bodies, comments, discussions, release notes, | ||
| `.github/ISSUE_TEMPLATE/*`, `.github/pull_request_template.md`): use GitHub features. | ||
| 4. Any other Markdown file (`docs/`, `CHANGELOG.md`, `AGENTS.md`, `SKILL.md`, anything a site | ||
| generator or another tool renders): tables, strikethrough, task lists and bare URLs only. | ||
| No alerts, footnotes, Mermaid, math, `<details>` or other github.com-only features. | ||
|
|
||
| Creating a new README or template under rule 2 or 3 with nothing under rule 1: write it with | ||
| GitHub features and ask the user in one line whether that is OK. | ||
|
|
||
| ## Quick reference (github.com only unless noted) | ||
|
|
||
| | Feature | Syntax and gotchas | | ||
| |---|---| | ||
| | Alerts | `> [!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]` on the first quote line. One or two per page, not nested. | | ||
| | Footnotes | `text[^1]` and `[^1]: note` anywhere; rendered at the bottom. Not in wikis. | | ||
| | Heading anchors | Lowercase; **every word kept**; each space becomes `-`; other punctuation dropped (so ` & ` leaves `--`); formatting markers removed; non-ASCII letters kept; repeats get `-1`, `-2`. `## Use a _CLI_ & the API, v2!` is `#use-a-cli--the-api-v2`. | | ||
| | Line breaks | In `.md` files a single newline is not a break: end the line with `\` (visible). Avoid two trailing spaces, which work but are invisible in most editors. In issues, PRs and comments a newline is a break. | | ||
| | Links | Write `[label](url)`. Use `<https://...>` only when the label should be the URL itself. Never leave a bare URL, even where GitHub would autolink it. | | ||
| | Underline, sub, sup | `<ins>`, `<sub>`, `<sup>` | | ||
| | Relative links | Resolve against the current branch; `/` starts at the repo root. Prefer them for repo files and images. | | ||
| | Task lists (all renderers) | `- [ ]`, `- [x]`; escape a leading paren: `- [ ] \(Optional)`. | | ||
| | Tables (all renderers) | Blank line before; `---` per column; escape `\|`, even inside code spans. | | ||
|
|
||
| ## References, mentions and keywords | ||
|
|
||
| - `#26`, `GH-26`, `owner/repo#26`, a full SHA and `owner/repo@sha` autolink **only in issues, | ||
| PRs, discussions and comments**. In repo files and wikis they are plain text: write explicit | ||
| links. | ||
| - `@name` and `@org/team` notify people. Put non-user `@` text (`@types/node`, npm scopes) in | ||
| backticks. | ||
| - `Closes #N` (also close/fix/resolve in any tense) in a PR body closes the issue on merge. | ||
|
|
||
| ## More detail | ||
|
|
||
| - Raw HTML, what github.com strips, `<details>`, `<picture>`, centering and image sizing: | ||
| [references/html.md](references/html.md) | ||
| - Mermaid, maps, STL, math, code fences: [references/diagrams-math.md](references/diagrams-math.md) | ||
| - All autolink forms, unfurling, backlinks, label chips, color chips: | ||
| [references/autolinks.md](references/autolinks.md) | ||
| - Color, styled text, multi-column layout or animation without CSS (MathJax, Mermaid, | ||
| animated SVG): [references/fancy-tricks.md](references/fancy-tricks.md) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Autolinks, references and mentions on GitHub | ||
|
|
||
| ## Where they work | ||
|
|
||
| Issue, PR, discussion and commit-message text. **Not** in repo files (README.md included) or | ||
| wikis, which only autolink bare URLs (`https://...`, `www....`): there, write explicit links. | ||
| Everywhere, write URLs as `[label](url)` or `<url>`, not bare (see the Links row in SKILL.md). | ||
|
|
||
| ## Forms | ||
|
|
||
| | Write | Links to | | ||
| |---|---| | ||
| | `#26`, `GH-26` | issue or PR 26 in this repo | | ||
| | `owner/repo#26` | issue or PR in another repo | | ||
| | full 40-char SHA, or a 7+ char prefix | commit in this repo | | ||
| | `user@sha`, `owner/repo@sha` | commit in a fork or another repo | | ||
| | issue, PR or commit URL | shortened to the forms above | | ||
| | `https://github.com/o/r/labels/name` | label chip (same repo only; not if the name has a `.`) | | ||
| | `` `#0969DA` ``, `` `rgb(9,105,218)` ``, `` `hsl(212,92%,45%)` `` | color swatch (issues, PRs, discussions only; no spaces inside the backticks) | | ||
|
|
||
| Only these forms link: prefixed forms such as `pr#3` or `issue#1` stay plain text. | ||
| Custom autolinks (JIRA keys and so on) work only if a repo admin configured them. | ||
|
|
||
| **Create the target first.** A reference links only if the issue or PR (in that repo, for | ||
| `owner/repo#N`) already exists when the comment is posted or the commit is pushed. Creating it | ||
| later does not link the earlier text, so open the issue before writing `#N` or `Closes #N`. | ||
|
|
||
| ## Behavior to expect | ||
|
|
||
| - A reference that is the whole text of a list item unfurls to the title and state. | ||
| - Linking an issue or PR creates a backlink on the target. Use | ||
| `https://redirect.github.com/...` instead of `https://github.com/...` to avoid it (not on | ||
| `ghe.com` data-residency hosts). | ||
| - `@user` and `@org/team` notify them (only if they can read the repo); editing a mention into | ||
| a comment also notifies. Backtick any `@` text that is not a person to notify. | ||
|
|
||
| ## Keywords | ||
|
|
||
| - In a PR body, a commit message in the PR, or a commit pushed to the default branch: `close`, `closes`, `closed`, `fix`, | ||
| `fixes`, `fixed`, `resolve`, `resolves`, `resolved` + `#N` or `owner/repo#N` closes the issue | ||
| on merge. One keyword covers a comma-separated list on the same line: `Closes #1, #2` (spaces | ||
| around the comma are fine). | ||
| Anything else ends the list: `Closes #1 and #2` closes only #1, a doubled comma drops the | ||
| next issue, and a keyword after the references (`#1, #2 closes them`) closes none. | ||
| - `Duplicate of #N` as a comment marks a duplicate. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| # Diagrams, math and code fences on GitHub | ||
|
|
||
| All of these render in `.md` files, issues, PRs, discussions and wikis. Other renderers mostly | ||
| show them as plain code blocks. | ||
|
|
||
| ## Diagrams and maps (fence language decides) | ||
|
|
||
| | Fence | Renders | | ||
| |---|---| | ||
| | `mermaid` | Mermaid diagram (flowchart, sequence, pie, ...). A block holding only `info` shows the Mermaid version GitHub runs. | | ||
| | `geojson`, `topojson` | Interactive map | | ||
| | `stl` | 3D model viewer (ASCII STL) | | ||
|
|
||
| ## Math (MathJax) | ||
|
|
||
| - Inline: `$x^2$`, or `` $`x_1 * y_1`$ `` when the expression contains Markdown characters. | ||
| - Block: `$$...$$` on its own line(s), or a ```` ```math ```` fence (no `$$` needed). | ||
| - A literal `$` inside an expression: `\$`. Outside one but on the same line: | ||
| `<span>$</span>`. | ||
| - In `.md` files, text right before an inline-started `$$` block needs a line break (`\`). | ||
|
|
||
| ## Code fences | ||
|
|
||
| - Highlighting uses Linguist language names (`ruby`, `sh`, `powershell`). Use lower-case names | ||
| if the file also builds on GitHub Pages (Jekyll). | ||
| - Show a fence inside a fence by using a longer one outside (four backticks around three). | ||
| - Indented (non-fenced) code inside a list item needs eight spaces. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Fancy tricks: color, layout and motion without CSS | ||
|
|
||
| For when someone asks for a "hack": colors, styled text, multi-column layout or animation in a | ||
| README or comment. github.com strips CSS, `class`, `style` and all script (see | ||
| [html.md](html.md)), so every trick here goes through something GitHub renders itself: | ||
| images, MathJax, Mermaid or plain HTML attributes. Prefer plain Markdown unless the user asks. | ||
| Each trick costs accessibility or portability; say which when you use it. | ||
|
|
||
| ## Color | ||
|
|
||
| | Want | Trick | Notes | | ||
| |---|---|---| | ||
| | Colored text | `$\color{red}{\text{warning}}$` (MathJax) | Renders as math: not searchable, odd spacing, read as math by screen readers. Also `\color{#0969DA}`. `\colorbox` is blocked ("macros are not allowed"), so there is no background color. | | ||
| | Red and green lines | a ```` ```diff ```` block; lines starting with `+` or `-` | Code-block font; meant for diffs. | | ||
| | Colored boxes and blocks | a Mermaid diagram with `style A fill:#f9f,stroke:#333` or `classDef` | A diagram, not text; fine for charts and status boards. | | ||
| | Colored callouts | the five alerts (`> [!NOTE]` ...) | The only text color GitHub supports directly. | | ||
| | Highlight | `<mark>text</mark>` | GitHub's highlight color only: bright yellow in light mode, a dim tint in dark mode. | | ||
| | Color swatch | `` `#ff0000` `` | Issues, PRs and discussions only. | | ||
| | Any color, any font | an image (PNG or SVG banner, a shields.io badge) | Give it `alt` text. Use `<picture>` for separate dark and light versions. | | ||
|
|
||
| ## Fonts and type | ||
|
|
||
| - No font family or size control in HTML. Built in: headings, `<small>`, `<sub>`, `<sup>`, | ||
| bold, italic, strikethrough, and monospace from `<code>`, `<kbd>`, `<samp>`, `<tt>`. | ||
| - MathJax fonts and sizes inside `$...$`: `\mathbb{R}`, `\mathcal{A}`, `\mathfrak{g}`, | ||
| `\texttt{x}`, `\mathsf{x}`, `\large` up to `\Huge`. | ||
| - Unicode styled letters (𝓼𝓬𝓻𝓲𝓹𝓽, 𝔣𝔯𝔞𝔨𝔱𝔲𝔯, 𝙢𝙤𝙣𝙤) are plain text and always render, but | ||
| screen readers spell them out or skip them and search cannot find them. Avoid them for | ||
| anything important. | ||
|
|
||
| ## Layout | ||
|
|
||
| - **Columns and grids**: an HTML `<table>` (tables nest inside `<td>`), with `width`, `align`, | ||
| `valign`, `colspan`, `rowspan`. GitHub's stylesheet always draws borders and striping; | ||
| borderless tables are not possible. | ||
| - **Side-by-side image and text**: `<img align="right">` (see "Floating an image" in html.md). | ||
| - **Menus and accordions**: nested `<details>` blocks. | ||
| - **Centered hero section**: `<div align="center">` around an image, a heading and badges. | ||
|
|
||
| ## Motion and live content | ||
|
|
||
| - **Animated SVG** in an `<img>` (or `![]()`): CSS and SMIL animation inside the SVG file play; | ||
| its scripts never run. This is how "typing" banners work. Keep the file small. | ||
| - **Animated GIF, WebP or APNG**: work as images. Mind file size and motion sensitivity. | ||
| - **Live images** from an outside server (stats cards, "now playing", counters): GitHub fetches | ||
| images through its caching image proxy, so updates show up late and every reader's request | ||
| hides their IP from the server. | ||
| - **Theme-aware art**: `<picture>` with `prefers-color-scheme` sources swaps images between | ||
| dark and light mode. | ||
|
|
||
| ## Never possible | ||
|
|
||
| JavaScript, forms, `<iframe>` and other embeds, CSS of any kind, positioning beyond `align` | ||
| and floats, custom fonts, and background colors on text or blocks (other than an image). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # Raw HTML in GitHub Markdown | ||
|
|
||
| ## What github.com removes | ||
|
|
||
| **No JavaScript of any kind runs**: no `<script>`, event handlers, `javascript:` URLs, | ||
| `<iframe>`, `<object>`, `<embed>` or inline `<svg>`. For anything interactive, link to a | ||
| GitHub Pages site. | ||
|
|
||
| github.com sanitizes rendered Markdown much harder than the GFM spec's tag filter (which only | ||
| escapes `<title> <textarea> <style> <xmp> <iframe> <noembed> <noframes> <script> <plaintext>`). | ||
| github.com then runs an allow-list sanitizer (its public basis is `html-pipeline`'s | ||
| `SanitizationFilter`; production may differ slightly, so preview anything unusual): | ||
|
|
||
| - **Tags not on the list are removed but their text is kept**: `<center>`, `<font>`, `<u>`, | ||
| `<button>`, forms and `<input>`, `<svg>`, `<style>` ... `<script>` is removed with its content. | ||
| - **Attributes not on the list are removed**: `style`, `class`, event handlers (`onclick` ...). | ||
| So no colors, fonts or CSS layout. | ||
| - **Unsafe URLs are removed**: `href` keeps `http`, `https`, `mailto` and relative links (no | ||
| `javascript:`); `img src` keeps only `http`, `https` and relative (no `data:` images). | ||
| - `<li>` outside a list and table cells outside a `<table>` lose their tag. | ||
| - HTML comments `<!-- -->` and processing instructions `<?...?>` are hidden, so they work as | ||
| invisible notes or markers. | ||
|
|
||
| Tags kept: `h1`-`h6 p div span br hr a img picture source b i strong em s strike del ins sub sup | ||
| mark small abbr kbd code pre samp var tt q blockquote cite dfn time ruby rt rp ul ol li dl dt dd | ||
| table caption thead tbody tfoot tr th td details summary figure figcaption bdo wbr`. | ||
|
|
||
| Plain attributes kept on any of them include `align`, `width`, `height`, `alt`, `title`, | ||
| `name`, `lang`, `dir`, `colspan`, `rowspan`, `open`, `media`, `aria-label`; plus `href` on `a`, | ||
| `src` on `img`, `srcset` on `source`. | ||
|
|
||
| ## Markdown inside HTML | ||
|
|
||
| Markdown inside a block HTML element renders only after a blank line following the opening tag | ||
| (and before the closing tag): | ||
|
|
||
| ```markdown | ||
| <div align="center"> | ||
|
|
||
| # Title | ||
|
|
||
| </div> | ||
| ``` | ||
|
|
||
| ## Collapsed sections | ||
|
|
||
| ```markdown | ||
| <details> | ||
| <summary>Install on Windows</summary> | ||
|
|
||
| Steps in **Markdown** here (the blank line above matters). | ||
|
|
||
| </details> | ||
| ``` | ||
|
|
||
| `<details open>` starts expanded. | ||
|
|
||
| ## Dark and light mode images | ||
|
|
||
| ```markdown | ||
| <picture> | ||
| <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.png"> | ||
| <img src="assets/logo-light.png" alt="Project logo" width="200"> | ||
| </picture> | ||
| ``` | ||
|
|
||
| The `<img>` is the fallback for light mode and for other renderers. | ||
|
|
||
| ## Centering and sizing | ||
|
|
||
| - Center with `<p align="center">` or `<div align="center">` (CSS is stripped). | ||
| - Size images with `<img width="...">`; Markdown `![]()` cannot set a size. | ||
|
|
||
| ## Floating an image | ||
|
|
||
| `align="left"` or `align="right"` on an `<img>` floats it, and the following text wraps around | ||
| it (on other tags `align` only aligns text). `hspace="10"` adds side spacing. `<br clear="all">` | ||
| (or `left`, `right`) stops the wrap so the next heading starts below the image. Keep floated | ||
| images small: text beside them gets cramped on phones. | ||
|
|
||
| ```markdown | ||
| <img src="assets/logo.png" align="right" width="120" hspace="10" alt="Project logo"> | ||
|
|
||
| Text here wraps to the left of the logo. | ||
|
|
||
| <br clear="right"> | ||
| ``` | ||
|
|
||
| ## Custom anchors | ||
|
|
||
| `<a name="my-anchor"></a>` or `id="my-anchor"` on an allowed tag makes a link target | ||
| `#my-anchor` (GitHub stores it as `user-content-my-anchor`, and `#my-anchor` still jumps there). | ||
| `<a name>` is the documented form. Neither is listed in the file's outline or affects heading | ||
| anchor numbering. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.