Skip to content

Commit 7778644

Browse files
authored
syntax docs for footnotes (#50)
1 parent 2258ceb commit 7778644

File tree

3 files changed

+190
-1
lines changed

3 files changed

+190
-1
lines changed

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ The main documentation for this repository is located at:
1616
- In the tree-sitter-markdown and tree-sitter-markdown-inline directories, you rebuild the parsers using "tree-sitter generate; tree-sitter build". Make sure the shell is in the correct directory before running those. Every time you change the tree-sitter parsers, rebuild them and run "tree-sitter test". If the tests fail, fix the code. Only change tree-sitter tests you've just added; do not touch any other tests. If you end up getting stuck there, stop and ask for my help.
1717
- When attempting to find binary differences between files, always use `xxd` instead of other tools.
1818
- .c only works in JSON formats. Inside Lua filters, you need to use Pandoc's Lua API. Study https://raw.githubusercontent.com/jgm/pandoc/refs/heads/main/doc/lua-filters.md and make notes to yourself as necessary (use docs/for-claude in this directory)
19-
- Sometimes you get confused by macOS's weird renaming of /tmp. Prefer to use temporary directories local to the project you're working on (which you can later clean)
19+
- Sometimes you get confused by macOS's weird renaming of /tmp. Prefer to use temporary directories local to the project you're working on (which you can later clean)
20+
- The documentation in docs/ is a user-facing Quarto website. There, you should document usage and not technical details.

docs/syntax/footnotes.qmd

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
---
2+
title: "Footnotes"
3+
---
4+
5+
## Overview
6+
7+
Footnotes allow you to add references and additional information without cluttering your main text. In `quarto-markdown`, footnotes support both inline and fenced block syntax for definitions, giving you flexibility in how you structure your content.
8+
9+
## Syntax
10+
11+
### Inline Footnote Definitions
12+
13+
The standard Pandoc-style inline syntax uses square brackets with a caret:
14+
15+
```markdown
16+
[^id]: The footnote definition text goes here.
17+
```
18+
19+
This syntax is best for short, single-paragraph footnotes.
20+
21+
### Fenced Block Footnote Definitions
22+
23+
For longer footnotes that contain multiple paragraphs, lists, or other block-level content, use the fenced block syntax:
24+
25+
```markdown
26+
::: ^id
27+
Footnote content goes here.
28+
29+
You can include multiple paragraphs, lists, and other block elements.
30+
:::
31+
```
32+
33+
The fenced block syntax starts with `:::` followed by a space and `^` with the footnote identifier. The content is enclosed between the opening `:::` and closing `:::` markers.
34+
35+
### Footnote References
36+
37+
Reference a footnote in your text using the same `[^id]` syntax:
38+
39+
```markdown
40+
Here is some text with a footnote reference[^1].
41+
```
42+
43+
## Examples
44+
45+
### Basic Inline Footnote
46+
47+
Here is a sentence with a footnote[^basic].
48+
49+
[^basic]: This is a simple inline footnote definition.
50+
51+
```markdown
52+
Here is a sentence with a footnote[^basic].
53+
54+
[^basic]: This is a simple inline footnote definition.
55+
```
56+
57+
### Fenced Block with Single Paragraph
58+
59+
This example demonstrates a simple fenced block footnote[^simple].
60+
61+
::: ^simple
62+
This is a footnote defined using the fenced block syntax. It contains a single paragraph.
63+
:::
64+
65+
```markdown
66+
This example demonstrates a simple fenced block footnote[^simple].
67+
68+
::: ^simple
69+
This is a footnote defined using the fenced block syntax. It contains a single paragraph.
70+
:::
71+
```
72+
73+
### Fenced Block with Multiple Paragraphs
74+
75+
For more detailed footnotes, you can include multiple paragraphs[^multipara].
76+
77+
::: ^multipara
78+
This is the first paragraph of the footnote.
79+
80+
This is the second paragraph, providing additional context or information.
81+
82+
And here's a third paragraph for even more detail.
83+
:::
84+
85+
```markdown
86+
For more detailed footnotes, you can include multiple paragraphs[^multipara].
87+
88+
::: ^multipara
89+
This is the first paragraph of the footnote.
90+
91+
This is the second paragraph, providing additional context or information.
92+
93+
And here's a third paragraph for even more detail.
94+
:::
95+
```
96+
97+
### Fenced Block with Lists
98+
99+
Footnotes can contain complex content like lists[^withlist].
100+
101+
::: ^withlist
102+
This footnote contains a bulleted list:
103+
104+
- First item in the list
105+
- Second item in the list
106+
- Third item in the list
107+
108+
Lists help organize information within footnotes.
109+
:::
110+
111+
```markdown
112+
Footnotes can contain complex content like lists[^withlist].
113+
114+
::: ^withlist
115+
This footnote contains a bulleted list:
116+
117+
- First item in the list
118+
- Second item in the list
119+
- Third item in the list
120+
121+
Lists help organize information within footnotes.
122+
:::
123+
```
124+
125+
### Fenced Block with Inline Formatting
126+
127+
Footnotes support rich inline formatting[^formatted].
128+
129+
::: ^formatted
130+
This footnote has **bold text**, *italic text*, and `inline code`.
131+
132+
It also supports [links](https://example.com) and other inline elements.
133+
:::
134+
135+
```markdown
136+
Footnotes support rich inline formatting[^formatted].
137+
138+
::: ^formatted
139+
This footnote has **bold text**, *italic text*, and `inline code`.
140+
141+
It also supports [links](https://example.com) and other inline elements.
142+
:::
143+
```
144+
145+
### Mixing Inline and Fenced Block Footnotes
146+
147+
You can use both styles in the same document[^inline][^fenced].
148+
149+
[^inline]: This is an inline-style footnote definition.
150+
151+
::: ^fenced
152+
This is a fenced block footnote definition.
153+
154+
It can contain multiple paragraphs and other block-level content.
155+
:::
156+
157+
```markdown
158+
You can use both styles in the same document[^inline][^fenced].
159+
160+
[^inline]: This is an inline-style footnote definition.
161+
162+
::: ^fenced
163+
This is a fenced block footnote definition.
164+
165+
It can contain multiple paragraphs and other block-level content.
166+
:::
167+
```
168+
169+
### Named Footnote Identifiers
170+
171+
Footnote identifiers can be descriptive names, not just numbers[^descriptive-name].
172+
173+
::: ^descriptive-name
174+
Using descriptive names like `^descriptive-name` instead of numbers like `^1` can make your markdown more readable and maintainable.
175+
176+
Identifiers can include letters, numbers, and hyphens.
177+
:::
178+
179+
```markdown
180+
Footnote identifiers can be descriptive names, not just numbers[^descriptive-name].
181+
182+
::: ^descriptive-name
183+
Using descriptive names like `^descriptive-name` instead of numbers like `^1` can make your markdown more readable and maintainable.
184+
185+
Identifiers can include letters, numbers, and hyphens.
186+
:::
187+
```

docs/syntax/index.qmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ The features documented here are currently under development. The syntax and beh
1111
## Available Features
1212

1313
- [Definition Lists](definition-lists.qmd) - Create definition lists using an embedded markdown DSL
14+
- [Footnotes](footnotes.qmd) - Add footnotes with inline or fenced block syntax

0 commit comments

Comments
 (0)