md

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: Unlicense Imports: 17 Imported by: 0

Documentation

Overview

Package md provides types and functions for encoding markdown

Index

Constants

View Source
const (
	MarkdownTagTitle       = "title"
	MarkdownTagSummary     = "summary"
	MarkdownTagLayout      = "layout"
	MarkdownTagTags        = "tags"
	MarkdownTagCategory    = "category"
	MarkdownTagID          = "id"
	MarkdownTagImage       = "image"
	MarkdownTagBasePath    = "basepath"
	MarkdownTagTreeTitle   = "treetitle"
	MarkdownTagNextPage    = "next"
	MarkdownTagPrevPage    = "prev"
	MarkdownTagFirstPage   = "first"
	MarkdownTagLastPage    = "last"
	MarkdownTagIndexPage   = "index"
	MarkdownTagAliases     = "aliases"
	MarkdownTagLinks       = "links"
	MarkdownTagDescendants = "descendants"
	MarkdownTagLastMod     = "lastmod"
	MarkdownTagSitemap     = "sitemap"
)
View Source
const (
	DirectAncestorMarker   = "★"
	GeneralNotesSourceName = "General Notes"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CitationList

type CitationList struct {
	Suppress bool
	// contains filtered or unexported fields
}

CitationList tracks citations referenced during encoding and renders them as a footnotes section.

func (*CitationList) WriteTo

func (cl *CitationList) WriteTo(w io.Writer) (int64, error)

WriteTo writes the accumulated citations and notes section. It returns the number of bytes written and any error encountered.

type Content

type Content struct {
	LinkBuilder LinkBuilder
	Citations   CitationList
	// contains filtered or unexported fields
}

func (*Content) BlockQuote

func (b *Content) BlockQuote(m Text)

func (*Content) ConvertMarkdown

func (e *Content) ConvertMarkdown(text string, w io.Writer) error

func (*Content) DefinitionList

func (e *Content) DefinitionList(markups [][2]Text)

func (*Content) EmptyPara

func (e *Content) EmptyPara()

func (*Content) EncodeBold

func (e *Content) EncodeBold(m Text) Text

func (*Content) EncodeImage

func (e *Content) EncodeImage(alt string, link string) string

func (*Content) EncodeItalic

func (e *Content) EncodeItalic(m Text) Text
func (e *Content) EncodeLink(text Text, url string) Text
func (e *Content) EncodeModelLink(firstText Text, m any) Text

func (*Content) EncodeModelLinkDedupe

func (e *Content) EncodeModelLinkDedupe(firstText Text, subsequentText Text, m any) Text

func (*Content) EncodeModelLinkNamed

func (e *Content) EncodeModelLinkNamed(m any, nc render.NameChooser, pov *model.POV) Text

func (*Content) EncodeText

func (e *Content) EncodeText(ss ...string) Text

func (*Content) EncodeWithCitations

func (e *Content) EncodeWithCitations(s Text, citations []*model.GeneralCitation) Text

func (*Content) FactList

func (e *Content) FactList(items []render.FactEntry[Text])

func (*Content) Figure

func (e *Content) Figure(link string, alt string, caption Text, highlight *model.Region, downloadName string)

func (*Content) GroupedList added in v0.0.6

func (e *Content) GroupedList(groups []render.Grouping[Text])

func (*Content) Heading2

func (e *Content) Heading2(m Text, id string)

func (*Content) Heading3

func (e *Content) Heading3(m Text, id string)

func (*Content) Heading4

func (e *Content) Heading4(m Text, id string)

func (*Content) Image

func (e *Content) Image(link string, alt string)

func (*Content) Markdown

func (e *Content) Markdown(s string)

func (*Content) OrderedList

func (e *Content) OrderedList(ms []Text)

func (*Content) Para

func (b *Content) Para(m Text)

func (*Content) ParaWithFigure

func (e *Content) ParaWithFigure(text Text, link string, alt string, caption Text)

func (*Content) Pre

func (e *Content) Pre(s string)

func (*Content) Preface

func (b *Content) Preface(m Text)
func (e *Content) ResetSeenLinks()

func (*Content) SetBody

func (e *Content) SetBody(s string)

func (*Content) SetLinkBuilder

func (e *Content) SetLinkBuilder(l LinkBuilder)

func (*Content) String

func (e *Content) String() string

func (*Content) Timeline

func (e *Content) Timeline(rows []render.TimelineRow[Text])

func (*Content) UnorderedList

func (e *Content) UnorderedList(ms []Text)

func (*Content) WriteTo

func (e *Content) WriteTo(w io.Writer) (int64, error)

type Document

type Document struct {
	Content
	// contains filtered or unexported fields
}

func (*Document) AddAlias

func (b *Document) AddAlias(s string)

func (*Document) AddDescendant

func (b *Document) AddDescendant(name string, link string, detail string)
func (b *Document) AddLink(title string, link string, category model.LinkCategory)

func (*Document) AddTag

func (b *Document) AddTag(s string)

func (*Document) AddTags

func (b *Document) AddTags(ss []string)

func (*Document) BasePath

func (b *Document) BasePath(s string)

func (*Document) Category

func (b *Document) Category(s string)

func (*Document) Comment

func (b *Document) Comment(s string)

func (*Document) ID

func (b *Document) ID(s string)

func (*Document) Image

func (b *Document) Image(s string)

func (*Document) LastUpdated

func (b *Document) LastUpdated(t time.Time)

func (*Document) Layout

func (b *Document) Layout(s string)

func (*Document) PageBreak

func (b *Document) PageBreak()

func (*Document) SetFrontMatterField

func (b *Document) SetFrontMatterField(field, v string)

setFrontMatterFieldDict for setting a key on a scalar field for example

field: v

func (*Document) SetSitemapDisable

func (b *Document) SetSitemapDisable()

func (*Document) String

func (b *Document) String() string

func (*Document) Summary

func (b *Document) Summary(s string)

func (*Document) Title

func (b *Document) Title(s string)

func (*Document) TreeTitle

func (b *Document) TreeTitle(s string)

func (*Document) WriteTo

func (b *Document) WriteTo(w io.Writer) (int64, error)

type LinkBuilder

type LinkBuilder interface {
	LinkFor(v any) string
}

type MarkupText

type MarkupText string

type PlainText

type PlainText string

type Text

type Text string

Text is a piece of markdown encoded text

func (Text) IsZero

func (m Text) IsZero() bool

func (Text) String

func (m Text) String() string

func (Text) ToHTML

func (m Text) ToHTML(w io.Writer) error

Jump to

Keyboard shortcuts

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