Skip to content

mmcloughlin/cite

Repository files navigation

cite

Cite snippets in your godoc

go.dev Reference Build status Coverage Go Report Card

Install

go install github.com/mmcloughlin/cite/cmd/cite

Usage

To reference something, add an insert line into your godoc.

package example

import "fmt"

// Greet says hello to who.
//
// Insert: https://github.com/mmcloughlin/cite/blob/master/example/grinch.txt#L6-L8
func Greet(who string) {
	fmt.Printf("Hello, %s!\n", who)
}

Then run

$ cite process example.go

It will fetch the reference and insert it into your code.

package example

import "fmt"

// Greet says hello to who.
//
// Reference: https://github.com/mmcloughlin/cite/blob/master/example/grinch.txt#L6-L8
//
//	Every Who Down in Whoville Liked Christmas a lot...
//	But the Grinch,Who lived just north of Whoville, Did NOT!
//	The Grinch hated Christmas! The whole Christmas season!
//
func Greet(who string) {
	fmt.Printf("Hello, %s!\n", who)
}

It should look nice in your godoc.

Releases

No releases published

Packages

No packages published