markdown

package
v0.0.0-...-b00e855 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockQuote

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

func NewBlockQuote

func NewBlockQuote(s *goquery.Selection) *BlockQuote

func (*BlockQuote) Markdown

func (bq *BlockQuote) Markdown() string

type CodeBlock

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

func NewCodeBlock

func NewCodeBlock(s *goquery.Selection) *CodeBlock

func (*CodeBlock) Markdown

func (cb *CodeBlock) Markdown() string

type Element

type Element interface {
	Type() ElementType
	Markdown() string
}

func NewElement

func NewElement(elementType ElementType, text string) Element

func NewHeading

func NewHeading(s *goquery.Selection) Element
func NewLink(s *goquery.Selection) Element

NewLink creates a Markdown link from a *goquery.Selection.

func NewList

func NewList(s *goquery.Selection) Element

func NewListItem

func NewListItem(s *goquery.Selection) Element

func NewParagraph

func NewParagraph(s *goquery.Selection) Element

type ElementType

type ElementType int
const (
	ElementTypeParagraph ElementType = iota
	ElementTypeHeading
	ElementTypeAnchor
	ElementTypeList
	ElementTypeListItem
)

type Heading

type Heading struct {
	Level   int
	Content string
}

Heading represents a Markdown heading element. Example: # Heading 1 ## Heading 2 ### Heading 3

func (Heading) Markdown

func (h Heading) Markdown() string

func (Heading) Type

func (h Heading) Type() ElementType
type Link struct {
	Text string
	Href string
}

func (*Link) Markdown

func (l *Link) Markdown() string

func (*Link) Type

func (l *Link) Type() ElementType

type List

type List struct {
	Content   string
	IsOrdered bool
}

func (*List) Markdown

func (l *List) Markdown() string

func (*List) Type

func (l *List) Type() ElementType

type ListItem

type ListItem struct {
	Content string
}

func (*ListItem) Markdown

func (li *ListItem) Markdown() string

func (*ListItem) Type

func (li *ListItem) Type() ElementType

type MarkdownDocument

type MarkdownDocument interface {
	// Content returns the Markdown representation of the HTML document.
	Content() (string, error)

	// RemoveMatches scans the Markdown document for any elements whose
	// Markdown content matches the given regex pattern and removes them.
	RemoveMatches(*regexp.Regexp)
}

func NewDocument

func NewDocument(rawHtml string) MarkdownDocument

type Paragraph

type Paragraph struct {
	Content string
}

func (Paragraph) Markdown

func (p Paragraph) Markdown() string

func (Paragraph) Type

func (p Paragraph) Type() ElementType

type Text

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

func NewText

func NewText(s *goquery.Selection) *Text

func (*Text) Bold

func (t *Text) Bold() string

func (*Text) Italic

func (t *Text) Italic() string

func (*Text) Strikethrough

func (t *Text) Strikethrough() string

func (*Text) Trimmed

func (t *Text) Trimmed() string

Jump to

Keyboard shortcuts

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