godoc

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToHTML

func ToHTML(cg CommentGroup) (string, error)

ToHTML converts the given CommentGroup to HTML. It is more or less a re-implementation of the the standard library's go/doc.ToHTML with some minor additions and adjustments. A tiny subset of Markdown is supported to allow for some extra formatting.

A span of unindented non-blank comments is converted into a paragraph.

A span of indented comments is converted into a <pre> block, with the common indent prefix removed.

Text wrapped in backticks is converted into a <code> element.

Text wrapped in a pair of single asterisks, i.e. "*foo bar*", is converted into an <em> element.

Text wrapped in a pair of double asterisks, i.e. "**foo bar**", is converted into a <strong> element.

Plain URLs are converted into links.

URLs wrapped in parentheses and preceded by text delimited by square brackets are converted into links with the text being the link. e.g. [an example](http://example.com/) is converted into <a href="http://example.com/">an example</a>. Support for the title attribute is currently not provided.

Notes are omitted from the output. A note starts at beginning of a comment with "MARKER(uid):" and is followed by the note body. The note ends at the end of the comment group or at the start of another note in the same comment group, whichever comes first.

Types

type CommentGroup

type CommentGroup []string

CommentGroup is expected to hold the aggregated content of an ast.CommentGroup value. The content should be unmodified, meaning that the comment markers "//",

"/*", and "*/" are expected to be present.

type Note

type Note struct {
	Marker string
	UserId string
	Body   string
}

Jump to

Keyboard shortcuts

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