You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great Docs provides a linking system called GDLS (Great Docs Linking System) that automatically creates clickable navigation between your API reference pages. GDLS operates at three levels, each adding a different kind of connectivity to your documentation.
10
+
Documentation becomes much more useful when readers can follow connections between related items.
11
+
Without links, someone reading the `encode()` page has no easy way to discover that `decode()`
12
+
exists, or that a higher-level `Pipeline` class ties everything together. Cross-references turn
13
+
isolated pages into a connected web.
11
14
12
-
The first level is the `%seealso` directive, which adds structured "See Also" sections that link related items together. The second level is inline interlinks, which let you create Markdown-style links to API symbols anywhere in your prose. The third level is code autolinks, which automatically turn inline code references like `` `MyClass` `` into clickable links when they match a documented symbol.
15
+
Great Docs provides a linking system called GDLS (Great Docs Linking System) that automatically
16
+
creates clickable navigation between your API reference pages. GDLS operates at three levels, each
17
+
adding a different kind of connectivity to your documentation.
13
18
14
-
All three mechanisms resolve against the same `objects.json` inventory that Great Docs generates during the build. To preview which symbols are available for linking before you build, run:
19
+
The first level is the `%seealso` directive, which adds structured "See Also" sections that link
20
+
related items together. The second level is inline interlinks, which let you create Markdown-style
21
+
links to API symbols anywhere in your prose. The third level is code autolinks, which automatically
22
+
turn inline code references like `` `MyClass` `` into clickable links when they match a documented
23
+
symbol.
24
+
25
+
All three mechanisms resolve against the same `objects.json` inventory that Great Docs generates
26
+
during the build. To preview which symbols are available for linking before you build, run:
15
27
16
28
```bash
17
29
great-docs scan
18
30
```
19
31
32
+
This is useful for confirming the exact names you can reference in your docstrings.
33
+
20
34
## The `%seealso` Directive
21
35
22
-
The `%seealso` directive adds a "See Also" section to a reference page. Place it anywhere in a docstring with a comma-separated list of related names:
36
+
The most common cross-referencing need is connecting items that serve complementary roles: an
37
+
encoder and a decoder, a reader and a writer, or a class and its factory function. The `%seealso`
38
+
directive handles this by adding a "See Also" section at the bottom of a reference page. Place it
39
+
anywhere in a docstring with a comma-separated list of related names:
Great Docs strips the directive from the rendered output and generates a "See Also" section with clickable links at the bottom of the page.
50
+
Great Docs strips the directive from the rendered output and generates a "See Also" section with
51
+
clickable links at the bottom of the page.
34
52
35
53
Names can reference any exported symbol, including class methods using dotted notation:
36
54
@@ -46,7 +64,9 @@ class Validator:
46
64
47
65
### Adding Descriptions
48
66
49
-
You can add a short description after each name, separated by a colon. When descriptions are present, the See Also section renders as a list with each link followed by its description. Without descriptions, the links appear as a compact comma-separated line.
67
+
You can add a short description after each name, separated by a colon. When descriptions are
68
+
present, the See Also section renders as a list with each link followed by its description. Without
69
+
descriptions, the links appear as a compact comma-separated line.
If your docstrings use the NumPy docstring format, you can write a standard See Also section instead of (or in addition to) the `%seealso` directive. Great Docs recognizes this format, preserves the descriptions, and merges it with any `%seealso` entries on the same page. Duplicate references are deduplicated automatically.
93
+
If your docstrings use the NumPy docstring format, you can write a standard See Also section instead
94
+
of (or in addition to) the `%seealso` directive. Great Docs recognizes this format, preserves the
95
+
descriptions, and merges it with any `%seealso` entries on the same page. Duplicate references are
Both formats produce the same rendered output. If a page has both a `%seealso` directive and a NumPy
118
+
See Also section, the entries are merged and any duplicates are removed.
119
+
94
120
## Inline Interlinks
95
121
96
-
You can create inline links to other API items anywhere in your docstring text using the interlinks syntax. This is especially useful in class hierarchies and overview docstrings where you want to point readers to related pages. There are several forms:
122
+
Sometimes you need to mention another API item in the middle of a prose explanation rather than in a
123
+
structured "See Also" section. Inline interlinks let you create Markdown-style links to API symbols
124
+
anywhere in your docstring text. This is especially useful in class hierarchies and overview
125
+
docstrings where you want to point readers to related pages. There are several forms:
97
126
98
-
- Write `` [](`~mypackage.MyClass`) `` to display just `MyClass`. The `~` prefix strips the package path and shows only the short name.
99
-
- Write `` [](`mypackage.MyClass`) `` to display the full path `mypackage.MyClass`.
100
-
- Write `` [see this class](`mypackage.MyClass`) `` to display `see this class` as the link text.
101
-
- Write `` [see this class](`~mypackage.MyClass`) `` to also display `see this class`. When you supply custom link text in the brackets, it is always used as-is regardless of the `~` prefix.
127
+
- write `` [](`~mypackage.MyClass`) `` to display just `MyClass`. The `~` prefix strips the package
128
+
path and shows only the short name
129
+
- write `` [](`mypackage.MyClass`) `` to display the full path `mypackage.MyClass`
130
+
- write `` [see this class](`mypackage.MyClass`) `` to display `see this class` as the link text
131
+
- write `` [see this class](`~mypackage.MyClass`) `` to also display `see this class`; when you
132
+
supply custom link text in the brackets, it is always used as-is regardless of the `~` prefix
102
133
103
134
Here is an example showing interlinks in practice:
104
135
@@ -117,11 +148,16 @@ class BaseStore:
117
148
...
118
149
```
119
150
120
-
In the rendered documentation, each interlinks reference becomes a clickable link pointing to the target's reference page. Interlinks work in any part of a docstring: the summary line, extended description, parameter descriptions, notes, or any other section.
151
+
Interlinks work in any part of a docstring: the summary line, extended description, parameter
152
+
descriptions, notes, or any other section. If a reference cannot be resolved (for example, a typo in
153
+
the symbol name), the link text still renders but without a clickable link.
121
154
122
155
## Code Autolinks
123
156
124
-
Great Docs automatically converts inline code in docstrings into clickable links when the code matches a documented API symbol. No special syntax is needed; you use standard backtick code formatting and Great Docs does the rest:
157
+
The first two levels (`%seealso` and interlinks) require you to opt in by writing specific syntax.
158
+
Code autolinks take a different approach: they work automatically with no markup at all. When Great
159
+
Docs encounters inline code in a docstring that matches a documented API symbol, it turns that code
160
+
into a clickable link:
125
161
126
162
```python
127
163
classEngine:
@@ -133,11 +169,13 @@ class Engine:
133
169
...
134
170
```
135
171
136
-
In the rendered output, `` `Pipeline` `` and `` `run_pipeline()` `` become clickable links to their respective reference pages.
172
+
In the rendered output, `` `Pipeline` `` and `` `run_pipeline()` `` become clickable links to their
173
+
respective reference pages.
137
174
138
175
### Shortening Prefixes
139
176
140
-
For qualified names, you can control the display text with `~~` prefixes. The double tilde strips everything before the last component of the dotted path:
177
+
For qualified names, you can control the display text with `~~` prefixes. The double tilde strips
178
+
everything before the last component of the dotted path:
141
179
142
180
| What you write | What renders | What it links to |
143
181
|---|---|---|
@@ -147,11 +185,14 @@ For qualified names, you can control the display text with `~~` prefixes. The do
If the name does not match any documented symbol (e.g., `` `~~unknown_func()` ``), it renders as plain code with no link.
188
+
If the name does not match any documented symbol (e.g., `` `~~unknown_func()` ``), it renders as
189
+
plain code with no link.
151
190
152
191
### What Gets Autolinked
153
192
154
-
Any inline code that looks like an identifier or dotted path is a candidate for autolinking. Parentheses at the end are allowed. Code that contains arguments, spaces, or operators is not linked.
193
+
Any inline code that looks like an identifier or dotted path is a candidate for autolinking.
194
+
Parentheses at the end are allowed. Code that contains arguments, spaces, or operators is not
195
+
linked.
155
196
156
197
Examples that will be linked (if the name exists in the API):
157
198
@@ -165,30 +206,76 @@ Examples that will not be linked:
165
206
-`` `a + b` `` (contains operators)
166
207
-`` `-MyClass` `` (starts with an operator)
167
208
209
+
When in doubt, write the name as you normally would in a docstring. If it resolves, it becomes a
210
+
link; if not, it renders as plain code.
211
+
212
+
## Parentheses in Cross-References
213
+
214
+
The three cross-referencing levels handle parentheses differently, so it helps to know the rules:
215
+
216
+
**`%seealso`**: Write bare names without parentheses. Great Docs automatically appends `()` to
217
+
functions and methods in the rendered "See Also" section based on each symbol's type. Writing
218
+
`%seealso decode, MyClass` produces `decode()` and `MyClass` in the output, with the parentheses
219
+
added only where appropriate.
220
+
221
+
**Inline interlinks**: The target inside backticks should be the qualified name without parentheses.
222
+
Write `` [](`~mypackage.my_func`) ``, not `` [](`~mypackage.my_func()`) ``.
223
+
224
+
**Code autolinks**: Trailing `()` are optional and purely cosmetic. Both `` `my_func` `` and
225
+
`` `my_func()` `` resolve to the same page. The parentheses are preserved in the display text but
226
+
stripped during lookup. Use `()` when you want to signal to readers that something is callable:
227
+
228
+
```python
229
+
classPipeline:
230
+
"""Chain multiple engines together.
231
+
232
+
Call `run()` to execute the pipeline, or inspect `config` for current settings.
233
+
"""
234
+
...
235
+
```
236
+
237
+
In the rendered output, `run()` links to the `run` method page (with parentheses displayed) and
238
+
`config` links to the `config` attribute page (without parentheses).
239
+
168
240
### Disabling Autolinks
169
241
170
-
To prevent a specific piece of inline code from being autolinked, add the `{.gd-no-link}` class after the backtick span:
242
+
To prevent a specific piece of inline code from being autolinked, add the `{.gd-no-link}` class
243
+
after the backtick span:
171
244
172
245
```markdown
173
246
The `Config`{.gd-no-link} parameter is a plain dictionary, not the Config class.
174
247
```
175
248
176
-
This is useful when a word happens to match a documented symbol but you are referring to something else in context.
249
+
This is useful when a word happens to match a documented symbol but you are referring to something
250
+
else in context. You only need this occasionally; most autolinks are helpful and should be left in
251
+
place.
177
252
178
253
## Best Practices for Linking
179
254
180
-
Cross-references make documentation much more navigable, but a few guidelines help keep them useful rather than distracting.
255
+
Cross-references make documentation much more navigable, but a few guidelines help keep them useful
256
+
rather than distracting.
181
257
182
-
Use `%seealso` to connect items that serve complementary roles. If `encode()` and `decode()` are a natural pair, linking them together helps readers discover both. For larger groupings, a brief description after each name (using the colon syntax) gives context about why the link is relevant.
258
+
Use `%seealso` to connect items that serve complementary roles. If `encode()` and `decode()` are a
259
+
natural pair, linking them together helps readers discover both. For larger groupings, a brief
260
+
description after each name (using the colon syntax) gives context about why the link is relevant.
183
261
184
-
Use inline interlinks when you mention another symbol in the middle of a prose explanation. This keeps reading flow natural while still giving readers a path to the referenced page. The shortened form (with `~`) is usually the best choice because fully qualified paths can be long and interrupt the sentence visually.
262
+
Use inline interlinks when you mention another symbol in the middle of a prose explanation. This
263
+
keeps reading flow natural while still giving readers a path to the referenced page. The shortened
264
+
form (with `~`) is usually the best choice because fully qualified paths can be long and interrupt
265
+
the sentence visually.
185
266
186
-
Code autolinks require no effort on your part, since they happen automatically. But be aware that common words like `Config` or `Data` might match a symbol unexpectedly. If you notice unwanted links in the rendered output, add `{.gd-no-link}` to the specific code span.
267
+
Code autolinks require no effort on your part, since they happen automatically. But be aware that
268
+
common words like `Config` or `Data` might match a symbol unexpectedly. If you notice unwanted links
269
+
in the rendered output, add `{.gd-no-link}` to the specific code span.
187
270
188
271
## Next Steps
189
272
190
-
Cross-references turn a collection of standalone reference pages into a connected web of documentation. Use `%seealso` for structured navigation, interlinks for inline mentions, and let code autolinks handle the rest automatically.
273
+
Cross-references turn a collection of standalone reference pages into a connected web of
274
+
documentation. Use `%seealso` for structured navigation, interlinks for inline mentions, and let
275
+
code autolinks handle the rest automatically.
191
276
192
-
-[API Documentation](api-documentation.qmd) covers how discovery and organization work
193
-
-[Configuration](configuration.qmd) covers the functional settings in `great-docs.yml`
0 commit comments