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
I would like to generate documentation for a package in a project, but I only want to output certain functions (based on our internal naming convention). Is there a way to do designate which functions are included in the doc generation? Or must I use a gotxt template for this?
Would it be possible to get examples of how to do this with and without template files, if possible?
The text was updated successfully, but these errors were encountered:
Hi @mikeym88, there is currently no way to exclude functions or types based on their names when invoking the tool. It should be possible, if a bit clunky, to achieve with gotxt files. You would want to use a template override to replace the func and index templates. You can copy them from the default files and modify them to fit your needs. In the func template, you would need an if/else to exclude all output for the functions in question. and in index you'd want to exclude the funcs from the loop that adds them to the index.
With that said, there are still some edge cases around linking, etc. that would be difficult to resolve with pure gotxt templates. It may be reasonable to add an option to exclude certain symbols. If you can give me example of what types of names you want to exclude that might help me determine the feasibility/desired behavior of such a feature
@princjef Thanks for the reply. I ended up figuring out, and I did create custom template files for it.
I created a small utility written in Go that uses gomarkdoc with custom functions added to the templates, namely Contains, HasSuffix, HasPrefix and TrimSpace from the strings package. I was hoping to be able to pass the functions (or at least their names) from the command-line, but that might not be possible?
I would like to generate documentation for a package in a project, but I only want to output certain functions (based on our internal naming convention). Is there a way to do designate which functions are included in the doc generation? Or must I use a
gotxt
template for this?Would it be possible to get examples of how to do this with and without template files, if possible?
The text was updated successfully, but these errors were encountered: