mdparser

package module
v0.0.0-...-107f583 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: MIT Imports: 4 Imported by: 2

README

md-parser

A simple markdown parser by Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParseError

func NewParseError(content, msg string) error

Types

type BlockContent

type BlockContent struct {
	Contents []InlineContent
	Type     BlockContentType
}

type BlockContentType

type BlockContentType string
const (
	BlockContentTypeHeader1     BlockContentType = "header1"
	BlockContentTypeHeader2     BlockContentType = "header2"
	BlockContentTypeHeader3     BlockContentType = "header3"
	BlockContentTypeHeader4     BlockContentType = "header4"
	BlockContentTypeHeader5     BlockContentType = "header5"
	BlockContentTypeHeader6     BlockContentType = "header6"
	BlockContentTypeQuote       BlockContentType = "quote"
	BlockContentTypeCode        BlockContentType = "code"
	BlockContentTypeList        BlockContentType = "list"
	BlockContentTypeOrderedList BlockContentType = "orderedList"
	BlockContentTypeImage       BlockContentType = "image"
	BlockContentTypeLink        BlockContentType = "link"
	BlockContentTypeTable       BlockContentType = "table"
	BlockContentTypeHorizontal  BlockContentType = "horizontal"
	BlockContentTypeParagraph   BlockContentType = "paragraph"
	BlockContentTypeEmpty       BlockContentType = "empty"
	BlockContentTypeUnknown     BlockContentType = "unknown"
)

func (BlockContentType) IsHeader

func (t BlockContentType) IsHeader() bool

func (BlockContentType) String

func (t BlockContentType) String() string

type InlineContent

type InlineContent struct {
	ContainedTypes []InlineContentType
	Text           string
	Src            string
	Alt            string
	HasChildren    bool
	Children       []InlineContent
}

type InlineContentType

type InlineContentType string
const (
	InlineContentTypeBold      InlineContentType = "bold"
	InlineContentTypeItalic    InlineContentType = "italic"
	InlineContentTypeUnderline InlineContentType = "underline"
	InlineContentTypeStrike    InlineContentType = "strike"
	InlineContentTypeLink      InlineContentType = "link"
	InlineContentTypeImage     InlineContentType = "image"
	InlineContentTypeCode      InlineContentType = "code"
	InlineContentTypeText      InlineContentType = "text"
	InlineContentTypeUnknown   InlineContentType = "unknown"
)

func (InlineContentType) String

func (t InlineContentType) String() string

type InlineSig

type InlineSig struct {
	Start string
	End   string
	Type  InlineContentType
}

type ParseError

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

func (ParseError) Content

func (e ParseError) Content() string

func (ParseError) Error

func (e ParseError) Error() string

func (ParseError) Unwrap

func (e ParseError) Unwrap() error

type ParsedMD

type ParsedMD struct {
	Raw    string
	Blocks []BlockContent
}

func Parse

func Parse(b []byte) (*ParsedMD, error)

Directories

Path Synopsis
mokuji module

Jump to

Keyboard shortcuts

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