Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ only skills; commands, agents or hooks may follow.
Apache-2.0, ...). List any local edit to a copied skill in `NOTICE`. Before adding, read the
whole skill: no hidden instructions, no `curl | sh`, no unexpected hosts.
- **Skills written here** (`github-pages`, `github-apps`, `repo-badges`,
`github-mcp-config`, `security-advisories`, `workflows-actions-reuse`): only for a topic with
`github-mcp-config`, `security-advisories`, `workflows-actions-reuse`,
`github-markdown`): only for a topic with
no upstream skill worth copying. They are MIT under the repo's `LICENSE`, so they have no `LICENSE.txt`,
`metadata.upstream` or `NOTICE` entry, and the upstream sync skips them. Before merging a
new one or a large change, test it the superpowers `writing-skills` way: give the same tasks
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ may follow.
| `pull-request-code-review` | Reviewing someone else's PR: reading the diff in context, a batched pending review with line comments, choosing the verdict (GitHub MCP tools) | [github/github-mcp-server](https://github.com/github/github-mcp-server) |
| `pull-request-review-feedback` | Working through review threads on your PR: decide, reply, resolve only what is settled (GitHub MCP tools) | [github/github-mcp-server](https://github.com/github/github-mcp-server) |
| `repo-badges` | README badges: GitHub status badges, shields.io static badges and logos (Simple Icons, svgl fallback), and badges rendered in CI with a pinned renderer onto an orphan `badges` branch, with no badge service | this repo |
| `github-markdown` | GitHub-only Markdown: when to use it vs plain Markdown, alerts, footnotes, heading anchors, where `#123` and SHAs autolink, mentions, closing keywords, stripped HTML, `<details>`, `<picture>`, Mermaid and math | this repo |
| `github-mcp-config` | Adding GitHub's official MCP server when a skill needs its tools and none is configured: check for an existing one, remote (PAT, or OAuth on Copilot hosts) vs local (OAuth without a token), per-harness token syntax, toolsets and read-only | this repo |
| `security-advisories` | Handling vulnerabilities on GitHub: private vulnerability reporting, SECURITY.md, editing the reported draft advisory, temporary private fork, CVE request, credits, publishing, when Dependabot alerts, reporting upstream | this repo |
| `gh-attach` | Uploading screenshots and files to PRs, issues and comments, and downloading attachments, with the `gh attach` extension | [sudosubin/gh-attach](https://github.com/sudosubin/gh-attach) |
Expand Down
3 changes: 2 additions & 1 deletion skills.sh.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@
},
{
"title": "Repositories and hosting",
"description": "Pages, README badges and Codespaces.",
"description": "Pages, README writing and badges, and Codespaces.",
"skills": [
"github-pages",
"repo-badges",
"github-markdown",
"github-codespaces-efficiency"
]
}
Expand Down
58 changes: 58 additions & 0 deletions skills/github-markdown/SKILL.md
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)
45 changes: 45 additions & 0 deletions skills/github-markdown/references/autolinks.md
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.
Comment thread
rjstone marked this conversation as resolved.
Resolved
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.
27 changes: 27 additions & 0 deletions skills/github-markdown/references/diagrams-math.md
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.
54 changes: 54 additions & 0 deletions skills/github-markdown/references/fancy-tricks.md
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).
94 changes: 94 additions & 0 deletions skills/github-markdown/references/html.md
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.
11 changes: 11 additions & 0 deletions skills/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@
"references/templates.md"
]
},
{
"name": "github-markdown",
"version": "0.2.2",
"files": [
"SKILL.md",
"references/autolinks.md",
"references/diagrams-math.md",
"references/fancy-tricks.md",
"references/html.md"
]
},
{
"name": "github-mcp-config",
"version": "0.1.3",
Expand Down