Menu
Writing guides
“Everything you can use in a guide page, with the Markdown that makes it.”
This page is a cheat sheet for writing guides here. Every feature below shows the Markdown that produces it.
Topics, parts and pages#
Bytes are organized in three levels. Every folder is a level, and every folder has an _index.md:
content/bytes/
├── _index.md ← the Bytes landing page
└── http/ ← a topic: "How HTTP works"
├── _index.md ← topic title, intro text, order
├── basics/ ← a part: "The basics"
│ ├── _index.md
│ ├── what-is-http.md ← a page (step 1)
│ ├── anatomy-of-a-url.md ← step 2
│ └── request-response-cycle/ ← a page with images gets its own folder
│ ├── index.md
│ └── cycle.svg
└── requests/ ← next part
├── _index.md
└── http-methods.md- A topic gets a card on the Bytes page and its own sidebar.
- A part groups pages under a heading in the sidebar.
- Pages are numbered as steps (“Step 3 of 9”) in reading order, with Previous/Next links that run through the whole topic.
You can nest parts inside parts, and a topic can also hold pages directly without any parts.
Order with weight#
Every _index.md and page has a weight. Lower comes first:
1---
2title: "Requests"
3description: "What the client sends: methods, headers and data."
4weight: 2
5---1---
2title: "HTTP methods"
3description: "Shown under the title, in the outline and in search results."
4weight: 1
5---Adding things#
hugo new content bytes/http/requests/cookies.mdTo start a new topic, create content/bytes/<topic>/_index.md with a title, description, weight and an intro. Give it a color (indigo, teal, amber, violet, rose or sky) and an icon: they style its animated cover, its cards and its share images. See brand/README.md for which color fits which kind of topic. Its landing page shows the intro, a Start reading button and a numbered outline of every page.
Linking between pages#
Use relative links to the folder of the page:
See [status codes](../../responses/status-codes/).Code blocks#
Filename tab#
Add a title after the language:
1```js {title="src/app.js"}
2console.log("hi")
3```const app = createApp();
app.listen(3000, () => console.log("listening on :3000"));Highlighting lines#
Use hl_lines to draw attention to specific lines:
```go {hl_lines="6-7"} 1package main
2
3import "fmt"
4
5func main() {
6 total := 0
7 for i := 1; i <= 10; i++ {
8 total += i
9 }
10 fmt.Println(total)
11}Line numbers#
Code longer than two lines gets line numbers automatically. Shell snippets don’t. Turn them off with {lineNos=false} or start from another number with {linenostart=40}.
hugo new content bytes/http/requests/cookies.md
./dev.shCallouts#
Use GitHub-style alerts for side notes:
> [!NOTE]
> Useful information the reader should notice.Note
Useful information the reader should notice, even when skimming.
Tip
A better or easier way to do something.
Important
Something the reader needs to know to succeed.
Warning
Something that can go wrong if they’re not careful.
Caution
Something that can break things or lose data.
Custom title
Write your own title after the type.
Images#
Put the image in the page’s folder and reference it by name. The text in quotes becomes the caption. Click an image to zoom in.
Tables#
| Syntax | Result |
|---|---|
**bold** | bold |
*italic* | italic |
`code` | code |
[link](url) | link |
Glossary terms#
Wrap a term to give it a hover card with its short definition. The definitions live in data/glossary.yaml, and every term also gets an entry on the Glossary page, with the bytes that use it.
The browser asks a {{< g "dns" />}} resolver for the address.
Computers connect to {{< g "ip-address" >}}IP addresses{{< /g >}}, not names.The browser asks a DNS resolver for the address. Computers connect to IP addresses, not names.
To add a term, add an entry to data/glossary.yaml with a term, a one- or two-sentence def and the page that explains it best in see. A typo in a term’s id stops the build with a clear message, so broken terms never go live.
Margin notes#
For a fun fact or an aside that would interrupt the sentence:
HTTP has a status code for teapots.{{< note >}}`418 I'm a teapot`, from a 1998 April Fools' joke.{{< /note >}}HTTP has a status code for teapots.418 I'm a teapot, from a 1998 April Fools’ joke. It shows as a small number after the sentence: hover it, or tap it on a phone, and the note opens in a little card. It never takes extra space on the page.
Byte check#
A short quiz at the end of a byte. Getting every answer right commits the byte to the reader’s learning path, so put two or three questions in the front matter of every byte:
1---
2title: "HTTP methods"
3check:
4 - q: "Which method should **never** change data on the server?"
5 options: ["`GET`", "`POST`", "`DELETE`"]
6 answer: 0 # the right option, counting from 0
7 why: "`GET` is *safe*, so browsers and crawlers may send it freely."
8---Bytes without a check end with a Commit this byte button instead. It unlocks once the reader has spent about a third of the reading time on the page and reached the end, so a quick scroll doesn’t count. Either way, a committed byte can be undone with git reset.
Interactive examples#
Two “Try it” widgets you can drop into any page:
1{{< url-explorer >}}
2{{< url-explorer "https://example.com/search?q=http#results" >}}
3
4{{< http-builder >}}
5{{< http-builder method="POST" path="/todos" >}}url-explorertakes a URL apart, colors each part and shows the request the server actually receives.http-buildersends requests to a pretend to-do API that runs in the reader’s browser, and shows the raw request and response.
Byte cards#
Give a topic up to five takeaways (each under ~100 characters). The topic page then shows a shareable image card with a download button:
1takeaways:
2 - "HTTP is plain text: a client sends a request, the server sends one response."
3 - "Status codes by first digit: 2xx worked, 3xx look elsewhere, 4xx your mistake, 5xx theirs."Every page also gets its own link preview image automatically, with its title on the AminBytes background. To change their design, edit brand/src/og.py and run python3 brand/src/og.py.
Read it through, then commit this byte to your learning path.
$ git add writing-docs.mdStaging while you read…
$ git commit -m "learn: Writing guides"
[main 7b9d812] learn: Writing guides
1 byte changed, 6 minutes of reading(+)
See it on your path Committed . Want to read it again from scratch?