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
Copy file name to clipboardExpand all lines: README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@
10
10
11
11
*mkdocstrings-crystal* allows you to insert API documentation (generated from [Crystal][]'s source code and doc comments) as part of any page on a [MkDocs][] site.
12
12
13
+
[See it in action][showcase].
14
+
13
15
To install it, run (possibly in a [virtualenv][]):
Copy file name to clipboardExpand all lines: docs/README.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,23 @@
1
1
# mkdocstrings-crystal
2
2
3
-
Crystal language doc generator for [MkDocs][], via [mkdocstrings][].
3
+
**[Crystal][] language doc generator for [MkDocs][], via [mkdocstrings][].**
4
4
5
5
## Installation
6
6
7
7
```console
8
8
$ pip install mkdocstrings-crystal
9
9
```
10
10
11
-
[Continue with **quickstart**](quickstart/index.md).
11
+
[Continue with **quickstart**](quickstart/index.md).
12
+
Or use [the migration guide](quickstart/migrate.md) for a low-effort transition from `crystal doc`.
12
13
13
14
## Introduction
14
15
15
16
Crystal has [its own easy-to-use generator of API documentation sites](https://crystal-lang.org/reference/using_the_compiler/#crystal-docs), but it's very rigid, as it doesn't attempt to do anything other than API documentation, so [these sites](https://crystal-lang.org/api/0.35.1/Process.html) end up being very isolated and prevent the author from presenting some kind of *story* about using their library.
16
17
17
18
Instead, this plugin is all about that *story*. It's very inspiring to look at [Python's documentation for `subprocess`](https://docs.python.org/3/library/subprocess.html), and hard to imagine a world in which this document is just an alphabetic dump of the functions in it.
18
19
19
-
So (matching the [idea behind *mkdocstrings*](https://pawamoy.github.io/mkdocstrings/usage/) but for Crystal), this allows you to just write textual documentation in Markdown and, in the middle of it, mention any identifier of a Crystal type, method etc., and have its API documentation (signature and doc comment) printed out right there.
20
+
So (matching the [idea behind *mkdocstrings*](https://mkdocstrings.github.io/usage/) but for Crystal), this allows you to just write textual documentation in Markdown and, in the middle of it, mention any identifier of a Crystal type, method etc., and have its API documentation (signature and doc comment) printed out right there.
20
21
21
22
## Usage
22
23
@@ -51,7 +52,7 @@ Then, in any `docs/**/*.md` file, you can **mention a Crystal identifier alone o
51
52
52
53
-- and in the output this will be replaced with generated API documentation for it, much like Crystal's own doc generator does.
53
54
54
-
Learn more about this syntax: [in *mkdocstrings* in general](https://pawamoy.github.io/mkdocstrings/usage/) (Crystal specifics are below).
55
+
Learn more about this syntax: [in *mkdocstrings* in general](https://mkdocstrings.github.io/usage/) (Crystal specifics are below).
55
56
56
57
The auto-replacement, of course, happens as part of a normal MkDocs build process:
57
58
@@ -64,7 +65,7 @@ $ mkdocs serve # live preview
64
65
65
66
The syntax for these "callouts" is almost exactly the same as in Crystal's own doc comments. As you may also know, if you **mention an identifier in backticks within a doc comment (e.g. <code>\`SomeClass#some_method\`</code>)**, Crystal's doc generator will cross-link to it. The same also works seamlessly here, and you don't need to change anything (other than possible edge cases).
66
67
67
-
But another powerful feature of this plugin is that you can **[cross-reference](https://pawamoy.github.io/mkdocstrings/usage/#cross-references) items like this *anywhere* on the site**, not just in doc comments. But the syntax is **`[SomeClass#some_method][]`** instead. Or `[with custom text][SomeClass#some_method]`. Note, though, that currently this cross-reference syntax is quite rigid, and you need to specify the exact absolute identifier as *mkdocstrings-crystal* determines it. To find that out, you could click on the wanted item in the navigation and then copy the anchor part from the URL bar -- the part after (not including) `#`.
68
+
But another powerful feature of this plugin is that you can **[cross-reference](https://mkdocstrings.github.io/usage/#cross-references) items like this *anywhere* on the site**, not just in doc comments. But the syntax is **`[SomeClass#some_method][]`** instead. Or `[with custom text][SomeClass#some_method]`. Note, though, that currently this cross-reference syntax is quite rigid, and you need to specify the exact absolute identifier as *mkdocstrings-crystal* determines it. To find that out, you could click on the wanted item in the navigation and then copy the anchor part from the URL bar -- the part after (not including) `#`.
68
69
69
70
## Usage details
70
71
@@ -73,5 +74,6 @@ We have been talking about seamlessly inserting Crystal documentation, but where
Copy file name to clipboardExpand all lines: docs/configuration.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Handler options
4
4
5
-
(See also: [*mkdocstrings* global options](https://pawamoy.github.io/mkdocstrings/usage/#global-options))
5
+
(See also: [*mkdocstrings* global options](https://mkdocstrings.github.io/usage/#global-options))
6
6
7
7
### `crystal_docs_flags:`
8
8
@@ -16,7 +16,7 @@ A list of command line arguments to pass to `crystal doc`. Mainly used to choose
16
16
: Set to `true` to also recursively render all `Foo::Sub::Types` whenever rendering a given class `Foo`.
17
17
18
18
`file_filters:`[list of strings]
19
-
: If a particular module spans over several files, you might want to choose to render only the sub-items (see `nested_types`) that came from a particular file. These patterns are regular expressions (not anchored) applied to the file path. Negating the patterns is done by starting it with `!` (which is then excluded from the following regex). This is very similar to [what's done in *mkdocstrings*](https://pawamoy.github.io/mkdocstrings/reference/handlers/python/#mkdocstrings.handlers.python.PythonCollector.default_config)
19
+
: If a particular module spans over several files, you might want to choose to render only the sub-items (see `nested_types`) that came from a particular file. These patterns are regular expressions (not anchored) applied to the file path. Negating the patterns is done by starting it with `!` (which is then excluded from the following regex). This is very similar to [what's done in *mkdocstrings*](https://mkdocstrings.github.io/reference/handlers/python/#mkdocstrings.handlers.python.PythonCollector.default_config)
Copy file name to clipboardExpand all lines: docs/troubleshooting.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,8 +32,8 @@ You can always [customize the styles with CSS](styling.md), but make sure you've
32
32
33
33
## MkDocs warns me about links to unfound documentation files
34
34
35
-
[See documentation of *mkdocstrings*](https://pawamoy.github.io/mkdocstrings/troubleshooting/#mkdocs-warns-me-about-links-to-unfound-documentation-files)
35
+
[See documentation of *mkdocstrings*](https://mkdocstrings.github.io/troubleshooting/#mkdocs-warns-me-about-links-to-unfound-documentation-files)
36
36
37
37
## Warning: could not find cross-reference target
38
38
39
-
[See documentation of *mkdocstrings*](https://pawamoy.github.io/mkdocstrings/troubleshooting/#warning-could-not-find-cross-reference-target)
39
+
[See documentation of *mkdocstrings*](https://mkdocstrings.github.io/troubleshooting/#warning-could-not-find-cross-reference-target)
0 commit comments