markdown

package
v0.0.0-...-6179034 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package markdown converts between Markdown and Confluence "storage" format (an XHTML-based representation).

Markdown -> storage uses goldmark to render XHTML, which the storage format accepts directly. storage -> Markdown walks the XHTML with x/net/html and emits Markdown, degrading gracefully (recursing into unknown/macro elements so their text survives).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromStorage

func FromStorage(storage string, opts ...Options) (string, error)

FromStorage converts Confluence storage-format XHTML to Markdown. It handles the standard block and inline HTML elements; elements it doesn't recognize (e.g. Confluence macros) are descended into so their text content survives.

An optional Options qualifies internal Confluence links (see Options.SpaceKey).

func ToStorage

func ToStorage(md []byte) (string, error)

ToStorage converts Markdown source to Confluence storage-format XHTML.

Types

type Options

type Options struct {
	// SpaceKey is the key of the space containing the page being converted. It
	// qualifies internal links that omit an explicit space (Confluence stores a
	// space key only for cross-space links, so same-space links rely on this).
	SpaceKey string

	// ResolvePageURL, if set, maps an internal page link (space key + title) to
	// an absolute, browser-clickable URL. Returning ok=false (or leaving this
	// nil) falls back to the lossless confluence:// descriptor.
	ResolvePageURL func(spaceKey, title string) (url string, ok bool)
}

Options configure storage→markdown conversion.

Jump to

Keyboard shortcuts

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