Skip to content

Latest commit

 

History

History
83 lines (54 loc) · 2.27 KB

README.md

File metadata and controls

83 lines (54 loc) · 2.27 KB

Go Doc Markdown

godoc alternative for static markdown documentation.

Motivation

Standard pkg.go.dev is awesome but not suitable for private repos. You can use pkgsite as local alternative but it's not perfect. Both occasionally skip certain files and generate incomplete documentation.

As stated in the comment of an engineer from Amazon sometimes it's a nightmare. You have to checkout a repo, run local server and open it in a browser only to read documentation.

With gdmd you don't even have to host your documentation, you can keep it in your repo along with the code. The generator creates a README.md with a package documentation in a package folder.
You can navigate through the documentation right in GitHub UI, any open directory with source code will render its documentation.

How to use

First, you have to

go install github.com/chocolacula/gdmd/cmd/gdmd

Then generate documentation for packages in a directory and all subdirectories

gdmd ./directory

Example

package main

The single package in the project, contains data representation, parsing and generation logic.

Index

Variables

Simple error to indicate empty folder

var EmptyErr = errors.New("empty folder")

Functions

func Generate(root string, pkg *Package)

Generate creates a markdown files for the given [Package] and its nested packages.

Types

type Function struct {
  Doc       string
  Name      string
  Pos       Position
  Recv      string // "" for functions, receiver name for methods
  Signature string
}

Function represents a function or method declaration.

func NewFunction(fset *token.FileSet, f *doc.Func) Function

You can compare full self-generated and pkg.dev documentation.