goldmark: github.com/yuin/goldmark Index | Files | Directories

package goldmark

import "github.com/yuin/goldmark"

Package goldmark implements functions to convert markdown text to a desired format.

Index

Package Files

markdown.go

func Convert Uses

func Convert(source []byte, w io.Writer, opts ...parser.ParseOption) error

Convert interprets a UTF-8 bytes source in Markdown and write rendered contents to a writer w.

func DefaultParser Uses

func DefaultParser() parser.Parser

DefaultParser returns a new Parser that is configured by default values.

func DefaultRenderer Uses

func DefaultRenderer() renderer.Renderer

DefaultRenderer returns a new Renderer that is configured by default values.

type Extender Uses

type Extender interface {
    // Extend extends the Markdown.
    Extend(Markdown)
}

An Extender interface is used for extending Markdown.

type Markdown Uses

type Markdown interface {
    // Convert interprets a UTF-8 bytes source in Markdown and write rendered
    // contents to a writer w.
    Convert(source []byte, writer io.Writer, opts ...parser.ParseOption) error

    // Parser returns a Parser that will be used for conversion.
    Parser() parser.Parser

    // SetParser sets a Parser to this object.
    SetParser(parser.Parser)

    // Parser returns a Renderer that will be used for conversion.
    Renderer() renderer.Renderer

    // SetRenderer sets a Renderer to this object.
    SetRenderer(renderer.Renderer)
}

A Markdown interface offers functions to convert Markdown text to a desired format.

func New Uses

func New(options ...Option) Markdown

New returns a new Markdown with given options.

type Option Uses

type Option func(*markdown)

Option is a functional option type for Markdown objects.

func WithExtensions Uses

func WithExtensions(ext ...Extender) Option

WithExtensions adds extensions.

func WithParser Uses

func WithParser(p parser.Parser) Option

WithParser allows you to override the default parser.

func WithParserOptions Uses

func WithParserOptions(opts ...parser.Option) Option

WithParserOptions applies options for the parser.

func WithRenderer Uses

func WithRenderer(r renderer.Renderer) Option

WithRenderer allows you to override the default renderer.

func WithRendererOptions Uses

func WithRendererOptions(opts ...renderer.Option) Option

WithRendererOptions applies options for the renderer.

Directories

PathSynopsis
astPackage ast defines AST nodes that represent markdown elements.
extension
extension/astPackage ast defines AST nodes that represents extension's elements
fuzz
parserPackage parser contains stuff that are related to parsing a Markdown text.
rendererPackage renderer renders the given AST to certain formats.
renderer/html
testutil
text
utilPackage util provides utility functions for the goldmark.

Package goldmark imports 6 packages (graph) and is imported by 6 packages. Updated 2019-08-30. Refresh now. Tools for package owners.