-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom template for protoc-gen-doc #121
Comments
This'd have to behave a little differently from the other doc rules, since it would have to accept a label that needs to be merged into the options attr in the underlying compilation. This isn't directly supported right now, but there should be a workable solution |
Was just looking for this, we would also like to pass in a custom template that we define potentially for our proto docs (markdown output) |
@aaliddell Just curious, with the work done in #54 to support additional options being passed to a plugin, could we do something similar out of the box? Passing in a local custom template file i.e. I assume that the rule could look like this:
|
That’s similar to how I’d like to do this, but the difficulty arises in telling Bazel to make that file available to protoc invocation sandbox. There is no mechanism presently for that in these rules, so we’d need a ‘doc_template_compile’ rule that has a ‘template’ attr or similar. Internally we’d then need a mechanism for poking extra files into the protoc action. |
I see, thanks for the explanation! I had a feeling that would be the limitation in that bazel wouldn't know about that file unless we had a bazel rule (as you a said doc_template_compile) which knows about the template file |
I'm adding this in 4.0.0: doc_template_compile(
name = "something.txt",
output_mode = "NO_PREFIX",
protos = [
":some_proto",
],
template = "template.txt",
) |
For the protoc-gen-doc rules, I would like to use a custom template.
This is the official documentation of how to use custom templates:
https://github.com/pseudomuto/protoc-gen-doc/wiki/Custom-Templates
I assume that the rule could look like this:
doc_template_compile(
name = "place_doc_proto",
template = "customTemplate.tmpl",
protos = ["@rules_proto_grpc//example/proto:place_proto"],
)
As a example, I created a merge request to a add reStructuredText template to protoc-gen-doc:
pseudomuto/protoc-gen-doc#440
I could implement the rule, but I need some guide about how to pass the template file as a data to the protoc plugin execution. What I am missing specifically is: how to pass arguments from the rule,throw the aspect, to the plugin.
The text was updated successfully, but these errors were encountered: