markdown

package
v1.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package markdown allows reading and editing Markdown files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Heading

type Heading struct {
	Level   int    // the level of the heading. 1 means it's the H1
	Content string // the text of the heading
	Header  string // the heading itself
}

Heading represents a markdown Heading

type MD

type MD struct {
	Headings []Heading
}

MD represents a markdown file

func NewMD

func NewMD(b []byte) MD

NewMD parses a new Markdown

func (MD) Bytes

func (md MD) Bytes() []byte

Bytes returns the markdown as []bytes, ignoring errors

func (MD) String

func (md MD) String() string

String returns the markdown as string, ignoring errors

func (MD) TocBytes

func (md MD) TocBytes() []byte

TocBytes returns the table of contents as []byte, ignoring errors

func (MD) TocString

func (md MD) TocString() string

TocString returns the table of contents as string, ignoring errors

func (MD) WriteContent

func (md MD) WriteContent(w io.Writer) (int64, error)

WriteContent writes the MDs content to the given writer

func (MD) WriteToc

func (md MD) WriteToc(w io.Writer) (int64, error)

WriteToc writes the table of contents to the given writer

Jump to

Keyboard shortcuts

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