markdown

package
v1.1.12 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 5 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 is the writer of the content of a document as Markdown, which a handler of the markdown namespace writes, and which keeps the part of it in the range set via metadata.WithRange

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeBlock

func CodeBlock(language, text string) string

CodeBlock returns the text as a fenced Markdown code block in the language, with a fence of more backticks than any run of them in the text, so the text can't end it

Types

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is written the content of a document as Markdown, by a handler of the markdown namespace, and keeps the part of it in the range set via metadata.WithRange. Once it has the part, a write returns an error, so the handler can stop, rather than converting the rest of the document. A handler returns the part with Metadata, which also takes the handler's error.

func NewWriter

func NewWriter(o *metadata.Opts) *Writer

NewWriter returns a writer which keeps the part of the Markdown in the range set via metadata.WithRange, or the first kilobyte when it wasn't set

func (*Writer) Metadata

func (w *Writer) Metadata(err error) ([]metadata.Metadata, error)

Metadata returns the part of the Markdown, and the handler's error, which is nil when it stopped as the writer had the part. The part is markdown:body; markdown:offset is the byte it starts at, when the range has an offset, which is moved forward to the start of a character; and markdown:next is the offset of the next part, when there's more. Returns an error when the offset is beyond the end of the Markdown.

func (*Writer) Write

func (w *Writer) Write(data []byte) (int, error)

Write keeps the part of the data in the range. It returns an error once it has the part, and there's more of the Markdown, so the handler can stop.

func (*Writer) WriteString

func (w *Writer) WriteString(s string) (int, error)

WriteString keeps the part of the string in the range, as Write does

Jump to

Keyboard shortcuts

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