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
Even though this package is pretty simple and the README covers
it fairly well, packages hosted at JuliaDocs presumably
should demonstrate best practices, and there is room for being more
expansive in a "real" docs page.
Note that the doctests fail without the trailing blank space added
to docs/src/index.md.
This also fixes the coverage badge.
A package to create simple "module docstrings" for Julia packages. These are targeted at summarizing the main components of your package, essentially as a prompt or reminder to users. For example:
8
8
@@ -18,16 +18,23 @@ search: ModuleDocstrings
18
18
• ModuleDocstrings.write: add an API summary docstring to a package.
19
19
```
20
20
21
-
Then, to learn more about `generate`:
21
+
This reminds users that the two main functions are `ModuleDocstrings.generate` and `ModuleDocstrings.write`.
22
+
23
+
These summaries are brief; to learn more about a particular function, read its help in full:
22
24
23
25
```julia
24
26
help?> ModuleDocstrings.generate
25
27
ModuleDocstrings.generate(mod::Module)
26
28
27
29
Return an API summary string for mod.
28
30
29
-
The summary is assembled from all docstrings in the package, picking the
30
-
first sentence of each docstring. Expect to need to edit these by hand to
31
-
produce something truly useful.
31
+
The summary is assembled from all docstrings in the package, picking the first sentence of each docstring. When added to the
32
+
package (see ModuleDocstrings.write), you should expect to make edits by hand:
33
+
34
+
• exclude docstrings that shouldn't appear in the API summary
32
35
36
+
• rephrase summaries for greater clarity or compactness (alternatively, consider making such changes to the original
37
+
docstring)
33
38
```
39
+
40
+
Once you've added the docstring to a `Pkg.develop`ed package, it can be submitted as a pull request.
+ Compute the minimum distance between `pos` and any point in `points`.
53
+
+ Compute the distance between points `pos1` and `pos2`.
54
+
- `radius`: Compute the radius of the cartesian-coordinate position `[x, y, z]`.
55
+
```
56
+
57
+
From this, you can see that both methods of `distance` are listed, as well as the single method for `radius`.
58
+
For each, only the first sentence is used in the summary.
59
+
60
+
If this were a package that you have in `Pkg.develop` mode, you could insert this string into the package with [`ModuleDocstrings.write`](@ref). However, in this case, you get
61
+
62
+
```jldoctest example; filter=(r"julia/dev/.*")
63
+
julia> ModuleDocstrings.write(TestDocStrings)
64
+
ERROR: TestDocStrings must be a writable package, but there is no corresponding file, suggesting it wasn't loaded from a package.
This error ocurred because we defined the module at the REPL; it will likewise error if you have `Pkg.add`ed rather than `Pkg.develop`ed. But for a package checked out in `develop` mode it will modify the main package file.
79
+
80
+
!!! warning
81
+
Be sure you've saved any work *before* running `ModuleDocstrings.write`.
82
+
83
+
Generally speaking, you should then edit the docstring to trim any methods that don't merit a mention in the summary, and/or to improve the clarity, brevity, or organization of the summaries. Sometimes, you may discover that you can improve the original source docstring as well.
84
+
85
+
Your changes can then be submitted as a pull request.
86
+
87
+
## API
88
+
89
+
Documentation for [ModuleDocstrings](https://github.com/JuliaDocs/ModuleDocstrings.jl).
0 commit comments