markdown

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package markdown parses the release notes of the update window. It knows what changelogs use: headings, paragraphs, nested lists, block quotes, fenced code, rules, emphasis, code spans and links. Everything else is text: raw HTML stays text, and links only go to http, https and mailto URLs, so notes cannot run code in the window.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTML

func HTML(blocks []Block) string

HTML renders blocks as HTML, escaping all their text.

func SafeURL

func SafeURL(u string) bool

SafeURL reports whether u is a URL the window opens: http, https or mailto.

Types

type Block

type Block struct {
	Kind BlockKind
	// Level is the level of a heading, from 1 to 6.
	Level int
	// Inlines are the text of a paragraph or heading.
	Inlines []Inline
	// Text is the text of fenced code.
	Text string
	// Ordered is set for a numbered list, whose Items hold the blocks of
	// each item; Blocks are those of a quote.
	Ordered bool
	Items   [][]Block
	Blocks  []Block
}

Block is a block of release notes.

func Parse

func Parse(src string) []Block

Parse parses release notes.

type BlockKind

type BlockKind uint8

BlockKind is what a Block is.

const (
	Paragraph BlockKind = iota
	Heading
	List
	Quote
	Code
	Rule
)

type Inline

type Inline struct {
	Kind InlineKind
	// Text is the text of a Text or CodeSpan.
	Text string
	// Children are the text of an Emphasis, Strong or Link.
	Children []Inline
	// URL is where a Link goes: an http, https or mailto URL.
	URL string
}

Inline is a run of text in a paragraph or heading.

type InlineKind

type InlineKind uint8

InlineKind is what an Inline is.

const (
	Text InlineKind = iota
	CodeSpan
	Emphasis
	Strong
	Link
)

Jump to

Keyboard shortcuts

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