vanitydoc

command module
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2023 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Overview

vanitydoc generates go documentation as a static site (HTML and Gemtext). When hosted at the package URL, it makes the package importable by the Go tools ("vanity import path").

For instance the import path for this command is code.pfad.fr/vanitydoc and the documentation is hosted at the following URL: https://code.pfad.fr/vanitydoc

Usage:

vanitydoc { [flags] | <jsonPath> }
# or using go run:     go run code.pfad.fr/vanitydoc@latest { [flags] | <jsonPath> }
# or using nix flakes: nix run git+https://code.pfad.fr/vanitydoc { [flags] | <jsonPath> }

If no jsonPath argument is provided, a local HTTP server will be started to render the documentation on demand, taking into account the following flags:

-addr string
	listen address to expose the documentation (default "localhost:8080")
-html.template.pattern string
	Pattern for additional HTML templates
-html.template.root string
	Root folder of the additional HTML templates (default ".")
-moduleDir string
	Local path to the module to generate the documentation for (default ".")
-modulePath string
	Module path (will be read from go.mod if empty)

If a jsonPath argument is provided, the given modules will be downloaded and their documentation generated.

Example to generate this documentation

{
  "domain": "code.pfad.fr",

  "defaults": { // allows to specify defaults for all "modules" below
    "kind": "forgejo", // forgejo, gitsrht and github are supported
    "url_prefix": "https://codeberg.org/pfad.fr/", // the module name will be appended
    "default_branch": "main"
  },
  "max_conns_per_host": 3,

  "modules": {
    "vanitydoc": {}, // use all defaults
    "devf": {},
    "fluhus/godoc-tricks": {
      "kind": "github",
      "url": "https://github.com/fluhus/godoc-tricks",
      "default_branch": "master",
      "archive_ref": "heads/master" // github tweak to download the archive of a branch
    },
    "exp": {
      "kind": "gitsrht",
      "url": "https://git.sr.ht/~oliverpool/exp"
    }
  },

  "html": {
    "output": "dist/http",
    "template.pattern": "header.gohtml",
    "template.root": ".",
    "first_clone_url_info_refs_path": "info/refs.redirect"
  },
  "gemtext": {
    "output": "dist/gmi"
  }
}

License and credits

Code is available under the BSD-3-Clause license.

Most of the templates originate from gddo (available under BSD-3-Clause). The CSS styling is achieved using simple.css by default (available under MIT). It includes the go-import meta tag as well as the meta tags proposed by the VCS Autodiscovery RFC

Directories

Path Synopsis
package autodiscovery is an implementation of the [VCS Autodiscovery RFC].
package autodiscovery is an implementation of the [VCS Autodiscovery RFC].
package pkg computes and generate documentation for a given package.
package pkg computes and generate documentation for a given package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL