在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):pseudomuto/protoc-gen-doc开源软件地址(OpenSource Url):https://github.com/pseudomuto/protoc-gen-doc开源编程语言(OpenSource Language):Go 93.4%开源软件介绍(OpenSource Introduction):protoc-gen-docThis is a documentation generator plugin for the Google Protocol Buffers compiler ( It supports proto2 and proto3, and can handle having both in the same context (see examples for proof). InstallationThere is a Docker image available ( If you'd like to install this locally, you can
Alternatively, you can download a pre-built release for your platform from the releases page. Finally, this plugin is also available on Maven Central. For details about how to use it, check out the gradle example. Invoking the PluginThe plugin is invoked by passing the
The format may be one of the built-in ones ( If the Using the Docker Image (Recommended)The docker image has two volumes: You could generate HTML docs for the examples by running the following:
By default HTML documentation is generated in For example, to generate Markdown for all the examples:
You can also generate documentation for a single file. This can be done by passing the file(s) to the command:
You can also exclude proto files that match specific path expressions. This is done by passing a second option delimited
by
Remember: Paths should be from within the container, not the host!
Simple UsageFor example, to generate HTML documentation for all
The plugin executable must be in Using a precompiled binaryAlternatively, you can specify a pre-built/not in
With a Custom TemplateIf you'd like to use your own template, simply use the path to the template file rather than the type.
For information about the available template arguments and functions, see Custom Templates. If you just want
to customize the look of the HTML output, put your CSS in Writing DocumentationMessages, Fields, Services (and their methods), Enums (and their values), Extensions, and Files can be documented. Generally speaking, comments come in 2 forms: leading and trailing. Leading comments Leading comments can be used everywhere. /**
* This is a leading comment for a message
*/
message SomeMessage {
// this is another leading comment
string value = 1;
}
Trailing comments Fields, Service Methods, Enum Values and Extensions support trailing comments. enum MyEnum {
DEFAULT = 0; // the default value
OTHER = 1; // the other value
} Excluding comments If you want to have some comment in your proto files, but don't want them to be part of the docs, you can simply prefix
the comment with Example: include only the comment for the /**
* @exclude
* This comment won't be rendered
*/
message ExcludedMessage {
string id = 1; // the id of this message.
string name = 2; // @exclude the name of this message
/* @exclude the value of this message. */
int32 value = 3;
} Check out the example protos to see all the options. Output ExampleWith the input the plugin gives the output Check out the |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论