8000 Is there a way to omit certain functions? · Issue #109 · princjef/gomarkdoc · GitHub
[go: up one dir, main page]

Skip to content

Is there a way to omit certain functions? #109

Open

Description

@mikeym88

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?

Activity

  1. princjef commented on Aug 18, 2023

    @princjef
    Owner

    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

  2. mikeym88 commented on Aug 19, 2023

    @mikeym88
    Author

    @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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0