|
4 | 4 | // levels, exporting both exported and unexported symbols, and custom formatters
|
5 | 5 | // for different backends.
|
6 | 6 | //
|
7 |
| -// Command Line Usage |
| 7 | +// # Command Line Usage |
8 | 8 | //
|
9 | 9 | // If you want to use this package as a command-line tool, you can install the
|
10 | 10 | // command by running the following on go 1.16+:
|
|
21 | 21 | // $ gomarkdoc --help
|
22 | 22 | // generate markdown documentation for golang code
|
23 | 23 | //
|
24 |
| -// Usage: |
25 |
| -// gomarkdoc [flags] [package ...] |
26 |
| -// |
27 |
| -// Flags: |
28 |
| -// -c, --check Check the output to see if it matches the generated documentation. --output must be specified to use this. |
29 |
| -// --config string File from which to load configuration (default: .gomarkdoc.yml) |
30 |
| -// -e, --embed Embed documentation into existing markdown files if available, otherwise append to file. |
31 |
| -// --footer string Additional content to inject at the end of each output file. |
32 |
| -// --footer-file string File containing additional content to inject at the end of each output file. |
33 |
| -// -f, --format string Format to use for writing output data. Valid options: github (default), azure-devops, plain (default "github") |
34 |
| -// --header string Additional content to inject at the beginning of each output file. |
35 |
| -// --header-file string File containing additional content to inject at the beginning of each output file. |
36 |
| -// -h, --help help for gomarkdoc |
37 |
| -// -u, --include-unexported Output documentation for unexported symbols, methods and fields in addition to exported ones. |
38 |
| -// -o, --output string File or pattern specifying where to write documentation output. Defaults to printing to stdout. |
39 |
| -// --repository.default-branch string Manual override for the git repository URL used in place of automatic detection. |
40 |
| -// --repository.path string Manual override for the path from the root of the git repository used in place of automatic detection. |
41 |
| -// --repository.url string Manual override for the git repository URL used in place of automatic detection. |
| 24 | +// Usage: |
| 25 | +// gomarkdoc [flags] [package ...] |
| 26 | +// |
| 27 | +// Flags: |
| 28 | +// -c, --check Check the output to see if it matches the generated documentation. --output must be specified to use this. |
| 29 | +// --config string File from which to load configuration (default: .gomarkdoc.yml) |
| 30 | +// -e, --embed Embed documentation into existing markdown files if available, otherwise append to file. |
| 31 | +// --footer string Additional content to inject at the end of each output file. |
| 32 | +// --footer-file string File containing additional content to inject at the end of each output file. |
| 33 | +// -f, --format string Format to use for writing output data. Valid options: github (default), azure-devops, plain (default "github") |
| 34 | +// --header string Additional content to inject at the beginning of each output file. |
| 35 | +// --header-file string File containing additional content to inject at the beginning of each output file. |
| 36 | +// -h, --help help for gomarkdoc |
| 37 | +// -u, --include-unexported Output documentation for unexported symbols, methods and fields in addition to exported ones. |
| 38 | +// -o, --output string File or pattern specifying where to write documentation output. Defaults to printing to stdout. |
| 39 | +// --repository.default-branch string Manual override for the git repository URL used in place of automatic detection. |
| 40 | +// --repository.path string Manual override for the path from the root of the git repository used in place of automatic detection. |
| 41 | +// --repository.url string Manual override for the git repository URL used in place of automatic detection. |
42 | 42 | // --tags strings Set of build tags to apply when choosing which files to include for documentation generation.
|
43 |
| -// -t, --template stringToString Custom template string to use for the provided template name instead of the default template. (default []) |
44 |
| -// --template-file stringToString Custom template file to use for the provided template name instead of the default template. (default []) |
45 |
| -// -v, --verbose count Log additional output from the execution of the command. Can be chained for additional verbosity. |
46 |
| -// --version Print the version. |
| 43 | +// -t, --template stringToString Custom template string to use for the provided template name instead of the default template. (default []) |
| 44 | +// --template-file stringToString Custom template file to use for the provided template name instead of the default template. (default []) |
| 45 | +// -v, --verbose count Log additional output from the execution of the command. Can be chained for additional verbosity. |
| 46 | +// --version Print the version. |
47 | 47 | //
|
48 | 48 | // The gomarkdoc command processes each of the provided packages, generating
|
49 | 49 | // documentation for the package in markdown format and writing it to console.
|
|
52 | 52 | //
|
53 | 53 | // gomarkdoc --output doc.md .
|
54 | 54 | //
|
55 |
| -// Package Specifiers |
| 55 | +// # Package Specifiers |
56 | 56 | //
|
57 | 57 | // The gomarkdoc tool supports generating documentation for both local packages
|
58 | 58 | // and remote ones. To specify a local package, start the name of the package
|
|
61 | 61 | // local and remote packages in the same command invocation as separate
|
62 | 62 | // arguments.
|
63 | 63 | //
|
64 |
| -// Output Redirection |
| 64 | +// # Output Redirection |
65 | 65 | //
|
66 | 66 | // By default, the documentation generated by the gomarkdoc command is sent to
|
67 | 67 | // standard output, where it can be redirected to a file. This can be useful if
|
|
87 | 87 | // PackageSpec struct in the github.com/princjef/gomarkdoc/cmd/gomarkdoc
|
88 | 88 | // package.
|
89 | 89 | //
|
90 |
| -// Template Overrides |
| 90 | +// # Template Overrides |
91 | 91 | //
|
92 | 92 | // The documentation information that is output is formatted using a series of
|
93 | 93 | // text templates for the various components of the overall documentation which
|
94 | 94 | // get generated. Higher level templates contain lower level templates, but
|
95 | 95 | // any template may be replaced with an override template using the
|
96 | 96 | // --template/-t option. The full list of templates that may be overridden are:
|
97 | 97 | //
|
98 |
| -// - file: generates documentation for a file containing one or more |
99 |
| -// packages, depending on how the tool is configured. This is the |
100 |
| -// root template for documentation generation. |
| 98 | +// - file: generates documentation for a file containing one or more |
| 99 | +// packages, depending on how the tool is configured. This is the |
| 100 | +// root template for documentation generation. |
101 | 101 | //
|
102 |
| -// - package: generates documentation for an entire package. |
| 102 | +// - package: generates documentation for an entire package. |
103 | 103 | //
|
104 |
| -// - type: generates documentation for a single type declaration, as well |
105 |
| -// as any related functions/methods. |
| 104 | +// - type: generates documentation for a single type declaration, as well |
| 105 | +// as any related functions/methods. |
106 | 106 | //
|
107 |
| -// - func: generates documentation for a single function or method. It may |
108 |
| -// be referenced from within a type, or directly in the package, |
109 |
| -// depending on nesting. |
| 107 | +// - func: generates documentation for a single function or method. It may |
| 108 | +// be referenced from within a type, or directly in the package, |
| 109 | +// depending on nesting. |
110 | 110 | //
|
111 |
| -// - value: generates documentation for a single variable or constant |
112 |
| -// declaration block within a package. |
| 111 | +// - value: generates documentation for a single variable or constant |
| 112 | +// declaration block within a package. |
113 | 113 | //
|
114 |
| -// - index: generates an index of symbols within a package, similar to what |
115 |
| -// is seen for godoc.org. The index links to types, funcs, |
116 |
| -// variables, and constants generated by other templates, so it may |
117 |
| -// need to be overridden as well if any of those templates are |
118 |
| -// changed in a material way. |
| 114 | +// - index: generates an index of symbols within a package, similar to what |
| 115 | +// is seen for godoc.org. The index links to types, funcs, |
| 116 | +// variables, and constants generated by other templates, so it may |
| 117 | +// need to be overridden as well if any of those templates are |
| 118 | +// changed in a material way. |
119 | 119 | //
|
120 |
| -// - example: generates documentation for a single example for a package or |
121 |
| -// one of its symbols. The example is generated alongside whichever |
122 |
| -// symbol it represents, based on the standard naming conventions |
123 |
| -// outlined in https://blog.golang.org/examples#TOC_4. |
| 120 | +// - example: generates documentation for a single example for a package or |
| 121 | +// one of its symbols. The example is generated alongside whichever |
| 122 | +// symbol it represents, based on the standard naming conventions |
| 123 | +// outlined in https://blog.golang.org/examples#TOC_4. |
124 | 124 | //
|
125 |
| -// - doc: generates the freeform documentation block for any of the above |
126 |
| -// structures that can contain a documentation section. |
| 125 | +// - doc: generates the freeform documentation block for any of the above |
| 126 | +// structures that can contain a documentation section. |
127 | 127 | //
|
128 |
| -// - import: generates the import code used to pull in a package. |
| 128 | +// - import: generates the import code used to pull in a package. |
129 | 129 | //
|
130 | 130 | // Overriding with the -t option uses a key-vaule pair mapping a template name
|
131 | 131 | // to the file containing the contents of the override template to use.
|
132 | 132 | // Specified template files must exist:
|
133 | 133 | //
|
134 | 134 | // gomarkdoc -t package=custom-package.gotxt -t doc=custom-doc.gotxt .
|
135 | 135 | //
|
136 |
| -// Additional Options |
| 136 | +// # Additional Options |
137 | 137 | //
|
138 | 138 | // As with the godoc tool itself, only exported symbols will be shown in
|
139 | 139 | // documentation. This can be expanded to include all symbols in a package by
|
|
148 | 148 | // written and embeds the documentation if present. Otherwise, the documentation
|
149 | 149 | // is appended to the end of the file.
|
150 | 150 | //
|
151 |
| -// gomarkdoc -o README.md -e . |
| 151 | +// gomarkdoc -o README.md -e . |
152 | 152 | //
|
153 | 153 | // When running with embed mode enabled, gomarkdoc will look for either this
|
154 | 154 | // single comment:
|
155 | 155 | //
|
156 |
| -// <!-- gomarkdoc:embed --> |
| 156 | +// <!-- gomarkdoc:embed --> |
157 | 157 | //
|
158 | 158 | // Or the following pair of comments (in which case all content in between is
|
159 | 159 | // replaced):
|
160 | 160 | //
|
161 |
| -// <!-- gomarkdoc:embed:start --> |
| 161 | +// <!-- gomarkdoc:embed:start --> |
162 | 162 | //
|
163 |
| -// This content is replaced with the embedded documentation |
| 163 | +// This content is replaced with the embedded documentation |
164 | 164 | //
|
165 |
| -// <!-- gomarkdoc:embed:end --> |
| 165 | +// <!-- gomarkdoc:embed:end --> |
166 | 166 | //
|
167 | 167 | // If you would like to include files that are part of a build tag, you can
|
168 | 168 | // specify build tags with the --tags flag. Tags are also supported through
|
|
195 | 195 | //
|
196 | 196 | // gomarkdoc --repository.url "https://github.com/princjef/gomarkdoc" --repository.default-branch master --repository.path / -o README.md .
|
197 | 197 | //
|
198 |
| -// Configuring via File |
| 198 | +// # Configuring via File |
199 | 199 | //
|
200 | 200 | // If you want to reuse configuration options across multiple invocations, you
|
201 | 201 | // can specify a file in the folder where you invoke gomarkdoc containing
|
|
210 | 210 | // separated by =. Options provided on the command line override those provided
|
211 | 211 | // in the configuration file if an option is present in both.
|
212 | 212 | //
|
213 |
| -// Programmatic Usage |
| 213 | +// # Programmatic Usage |
214 | 214 | //
|
215 | 215 | // While most users will find the command line utility sufficient for their
|
216 | 216 | // needs, this package may also be used programmatically by installing it
|
|
261 | 261 | // fmt.Println(out.Package(pkg))
|
262 | 262 | // }
|
263 | 263 | //
|
264 |
| -// Examples |
| 264 | +// # Examples |
265 | 265 | //
|
266 | 266 | // This project uses itself to generate the README files in
|
267 | 267 | // github.com/princjef/gomarkdoc and its subdirectories. To see the commands
|
|
0 commit comments