Skip to content

Commit d6be949

Browse files
authored
Give Gemini details on our Markdown conventions (#2905)
This should help it produce more consistent slides. For example, it will now know not to add sub-headings to slides. The initial version of this was generated by Gemini itself, and I then tweaked it by adding some more constraints.
1 parent 19116d2 commit d6be949

File tree

1 file changed

+64
-2
lines changed

1 file changed

+64
-2
lines changed

GEMINI.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,70 @@ list of options.
7272
development tasks.
7373
- **Course Content:** Markdown files in the `src/` directory, structured
7474
according to `src/SUMMARY.md`.
75-
- **Code Formatting:** `dprint fmt` is used to format all source files according
76-
to `rustfmt.toml` and `dprint.json`.
7775
- **Contributions:** Refer to `CONTRIBUTING.md` for guidelines on contributing
7876
to the project.
7977
- **Style:** Refer to `STYLE.md` for style guidelines.
78+
79+
## Markdown Conventions
80+
81+
- **Headings:**
82+
- **H1 (`#`):** Used for the main title of each page. Each slide has exactly
83+
one title.
84+
- **H2 (`##`):** Used for major sections. Slides do not use H2 headings to
85+
save vertical space; more slides are created instead.
86+
- **H3 (`###`):** Used for sub-sections, but not on slides.
87+
88+
- **Emphasis:**
89+
- **Bold (`**...**`):** Used to highlight key terms, commands, and for notes
90+
(e.g., `**Note:**`). The colon (`:`) is included inside the bold text for
91+
notes.
92+
- **Italic (`_..._`):** Used for general emphasis, titles of external
93+
articles, and for terms being defined.
94+
95+
- **Code:**
96+
- **Inline Code (`` `...` ``):** Used for code snippets, file names, commands,
97+
type names, and language keywords. Rust fragments are formatted as `rustfmt`
98+
would.
99+
- **Code Blocks (`` ```...``` ``):** Fenced code blocks are used for
100+
multi-line code examples, annotated with a language identifier (e.g.,
101+
`rust`, `c`, `ignore`).
102+
- **Interactive Code Blocks:** Rust examples are made interactive with
103+
`editable`. Examples that fail to compile are marked with `compile_fail` or
104+
`should_panic`.
105+
- **Diagrams:** The `bob` language identifier is used in code blocks to
106+
generate ASCII art diagrams.
107+
- **Formatting Control:** The `#[rustfmt::skip]` attribute is used to prevent
108+
`rustfmt` from formatting specific code blocks, though it is used rarely.
109+
110+
- **Lists:**
111+
- **Bulleted Lists:** Unordered lists are the primary way to lay out key
112+
points on slides.
113+
- **Glossary Format:** The glossary uses a specific format with a colon and
114+
backslash (`:\`) after each term to create a hard line break for visual
115+
formatting.
116+
117+
- **Other Markdown Elements:**
118+
- **Block Quotes (`> ...`):** Used sparingly for important notes, warnings, or
119+
supplementary information to draw attention.
120+
- **Links:** Both standard (`[text](url)`) and reference-style
121+
(`[text][label]`) links are used.
122+
- **Tables:** Markdown tables are used to present structured data.
123+
- **Horizontal Rules (`---`):** Not used on slides.
124+
125+
- **HTML Tags:**
126+
- **`<details>`:** Used for collapsible "speaker notes".
127+
- **`<kbd>`:** Used to denote keyboard keys.
128+
- **`<style>`:** Used rarely for targeted custom CSS.
129+
- **`<img>`:** Used to embed images.
130+
131+
- **Project-Specific Conventions:**
132+
- **mdbook Includes:** The `{{#include ...}}` helper is used to include
133+
snippets from other files.
134+
- **mdbook Segments:** The `{{%segment ...%}}` and `{{%session ...%}}` helpers
135+
are used for course structuring.
136+
- **Frontmatter:** Files start with YAML frontmatter (enclosed in `---`) to
137+
provide metadata.
138+
- **Doc Comments:** Standard Rust doc comments (`///`, `//!`) are used.
139+
`/// # Safety` is used to document safety preconditions for `unsafe` code.
140+
- **Comments:** HTML comments (`<!-- ... -->`) are used for editor/translator
141+
instructions and content control (e.g., `mdbook-xgettext: skip`).

0 commit comments

Comments
 (0)