Skip to content

Commit edc7dc0

Browse files
authored
Contributing: define rules for section titles (#428)
1 parent 307b504 commit edc7dc0

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

CONTRIBUTING.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,11 @@ References:
5353

5454
### 2. Units and prefixes:
5555

56-
Use Binary Prefixes (Ki, Mi) for Bytes. E.g.:
57-
58-
```
59-
1 MiB = 2^20 bytes = 1,048,576 bytes
60-
1 KiB = 2^10 bytes = 1,024 bytes
61-
```
62-
56+
- Use binary prefixes (Ki, Mi) for Bytes. E.g.:
57+
```
58+
1 MiB = 2^20 bytes = 1,048,576 bytes
59+
1 KiB = 2^10 bytes = 1,024 bytes
60+
```
6361
- Abbreviate bytes as "B" when used with a prefix. Spell out bits as "bits", even when used with a prefix, to avoid ambiguity. When used as a unit suffix, unit names are always singular, so it should be "20 kbit", not "20 kbits". (Also, "bytes" as a word is fine, just like "30 meters" is a valid way of talking about that length. But "Mbyte" and the like should go away.)
6462
- Hexadecimal values are uppercase and prefixed with `$`: e.g. `$ABCD`. To prevent clutter, don't use a prefix for hex numbers when it's clear from the context that a number is hexadecimal. For example, addresses and lists of opcodes. In those cases, zero-pad, even for smaller numbers: `0000-3FFF` instead of `0-3FFF`.
6563
- Put a space between numbers and their unit (ISO).
@@ -111,6 +109,35 @@ Those should either be written out (1 to 42), or use an "n-dash" `–` (can also
111109
Discussion:
112110
- [#341 (comment)](https://github.com/gbdev/pandocs/pull/341#discussion_r708681099)
113111

112+
### 8. Section titles
113+
114+
Section titles should not use Title Case.
115+
116+
Section titles for memory descriptions (typically, registers) should additionally respect the following rules for consistency.
117+
118+
The format is the following: `Address{–range} — {REG_NAME {(When)}:} Description {[read-only]|[write-only]}`.
119+
All parts between braces are optional, as needed.
120+
Note that the second dash is an em-dash `—`, not a regular dash/hyphen `-`.
121+
122+
Examples:
123+
- 014D — Header Checksum
124+
- 014E–014F — ROM Checksum
125+
- FF47 — BGP (Non-CGB Mode Only): BG Palette Data
126+
- FF51 — HDMA1 (CGB Mode Only): New DMA Source (High) \[write-only\]
127+
128+
Multiple registers must be handled as a memory range, and the `REG_NAME` and `Description` must be comma-separated lists as necessary.
129+
(It is expected that `When` and `rd-o/wr-o` are identical for all described registers.)
130+
131+
Examples:
132+
- 0104–0133 — Nintendo Logo
133+
- FF51–FF52 — HDMA1, HDMA2 (CGB Mode Only): New DMA Source (High, Low) \[write-only\]
134+
135+
It also follows that descriptions should not use commas outside of acting as separators for the aforementioned lists.
136+
137+
A convenience feature is provided for linking to sections, even across files: any link whose URL is only an anchor will be converted into an actual link to the section.
138+
For example, `[sample link text](<#014B — Old licensee code>)` will automatically be turned into `[sample link text](The_Cartridge_Header.html#014b--old-licensee-code)`.
139+
References to missing sections will be left as-is, and ambiguous references resolved arbitrarily (this should eventually change).
140+
(Note that the use of angle brackets `<>` here is [a CommonMark feature](https://spec.commonmark.org/0.30/#link-destination) to allow spaces in the link destination.)
114141

115142
## SVG
116143

@@ -167,4 +194,4 @@ Then, add a directive to embed the file's contents, for example `{{#include imgs
167194
Replace `imgs/ppu_modes_timing.svg` with the path to the SVG from the `src/` folder, and `2` with the line number the opening `<svg>` tag is on.
168195

169196
A word of caution about the directive's placement: if it is surrounded by empty lines, the image will be outside of any paragraphs, within the document's main flow.
170-
However, if it is adjacent to a line of text, it may be placed within the paragraph, which is likely not what you want.
197+
However, if it is adjacent to a line of text, it may be placed within the paragraph, which is likely not what you want.

0 commit comments

Comments
 (0)