markdown

package
v0.0.0-...-e61ee7f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KindAttention = ast.NewNodeKind("Attention")

KindAttention is the NodeKind for Attention

View Source
var KindColorPreview = ast.NewNodeKind("ColorPreview")

KindColorPreview is the NodeKind for ColorPreview

View Source
var KindDetails = ast.NewNodeKind("Details")

KindDetails is the NodeKind for Details

View Source
var KindIcon = ast.NewNodeKind("Icon")

KindIcon is the NodeKind for Icon

View Source
var KindSummary = ast.NewNodeKind("Summary")

KindSummary is the NodeKind for Summary

View Source
var KindTaskCheckBoxListItem = ast.NewNodeKind("TaskCheckBoxListItem")

KindTaskCheckBoxListItem is the NodeKind for TaskCheckBoxListItem

View Source
var MarkupName = "markdown"

MarkupName describes markup's name

Functions

func ExtractMetadata

func ExtractMetadata(contents string, out any) (string, error)

ExtractMetadata consumes a markdown file, parses YAML frontmatter, and returns the frontmatter metadata separated from the markdown content

func ExtractMetadataBytes

func ExtractMetadataBytes(contents []byte, out any) ([]byte, error)

ExtractMetadata consumes a markdown file, parses YAML frontmatter, and returns the frontmatter metadata separated from the markdown content

func NewHTMLRenderer

func NewHTMLRenderer(renderInternal *nocturnal.RenderInternal, opts ...html.Option) renderer.NodeRenderer

NewHTMLRenderer creates a HTMLRenderer to render in the gitea form.

func Render

func Render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error

Render renders Markdown to HTML with all specific handling stuff.

func RenderRaw

func RenderRaw(ctx *markup.RenderContext, input io.Reader, output io.Writer) error

RenderRaw renders Markdown to HTML without handling special links.

func RenderRawString

func RenderRawString(ctx *markup.RenderContext, content string) (string, error)

RenderRawString renders Markdown to HTML without handling special links and return string

func RenderString

func RenderString(ctx *markup.RenderContext, content string) (template.HTML, error)

RenderString renders Markdown string to HTML with all specific handling stuff and return string

Types

type ASTTransformer

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

ASTTransformer is a default transformer of the goldmark tree.

func NewASTTransformer

func NewASTTransformer(renderInternal *nocturnal.RenderInternal) *ASTTransformer

func (*ASTTransformer) Transform

func (g *ASTTransformer) Transform(node *ast.Document, reader text.Reader, pc parser.Context)

Transform transforms the given AST tree.

type Attention

type Attention struct {
	ast.BaseInline
	AttentionType string
}

Attention is an inline for an attention

func NewAttention

func NewAttention(attentionType string) *Attention

NewAttention returns a new Attention node.

func (*Attention) Dump

func (n *Attention) Dump(source []byte, level int)

Dump implements Node.Dump.

func (*Attention) Kind

func (n *Attention) Kind() ast.NodeKind

Kind implements Node.Kind.

type ColorPreview

type ColorPreview struct {
	ast.BaseInline
	Color []byte
}

ColorPreview is an inline for a color preview

func NewColorPreview

func NewColorPreview(color []byte) *ColorPreview

NewColorPreview returns a new Span node.

func (*ColorPreview) Dump

func (n *ColorPreview) Dump(source []byte, level int)

Dump implements Node.Dump.

func (*ColorPreview) Kind

func (n *ColorPreview) Kind() ast.NodeKind

Kind implements Node.Kind.

type Details

type Details struct {
	ast.BaseBlock
}

Details is a block that contains Summary and details

func NewDetails

func NewDetails() *Details

NewDetails returns a new Paragraph node.

func (*Details) Dump

func (n *Details) Dump(source []byte, level int)

Dump implements Node.Dump .

func (*Details) Kind

func (n *Details) Kind() ast.NodeKind

Kind implements Node.Kind.

type GlodmarkRender

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

func SpecializedMarkdown

func SpecializedMarkdown(ctx *markup.RenderContext) *GlodmarkRender

SpecializedMarkdown sets up the Gitea specific markdown extensions

func (*GlodmarkRender) Convert

func (r *GlodmarkRender) Convert(source []byte, writer io.Writer, opts ...parser.ParseOption) error

func (*GlodmarkRender) Renderer

func (r *GlodmarkRender) Renderer() renderer.Renderer

type HTMLRenderer

type HTMLRenderer struct {
	html.Config
	// contains filtered or unexported fields
}

HTMLRenderer is a renderer.NodeRenderer implementation that renders gitea specific features.

func (*HTMLRenderer) RegisterFuncs

func (r *HTMLRenderer) RegisterFuncs(reg renderer.NodeRendererFuncRegisterer)

RegisterFuncs implements renderer.NodeRenderer.RegisterFuncs.

type Header struct {
	Level int
	Text  string
	ID    string
}

Header holds the data about a header.

type Icon

type Icon struct {
	ast.BaseInline
	Name []byte
}

Icon is an inline for a Fomantic UI icon

func NewIcon

func NewIcon(name string) *Icon

NewIcon returns a new Paragraph node.

func (*Icon) Dump

func (n *Icon) Dump(source []byte, level int)

Dump implements Node.Dump .

func (*Icon) Kind

func (n *Icon) Kind() ast.NodeKind

Kind implements Node.Kind.

type RenderConfig

type RenderConfig struct {
	Meta markup.RenderMetaMode
	Icon string
	TOC  string // "false": hide,  "side"/empty: in sidebar,  "main"/"true": in main view
	Lang string
	// contains filtered or unexported fields
}

RenderConfig represents rendering configuration for this file

func (*RenderConfig) UnmarshalYAML

func (rc *RenderConfig) UnmarshalYAML(value *yaml.Node) error

UnmarshalYAML implement yaml.v3 UnmarshalYAML

type Renderer

type Renderer struct{}

Renderer implements markup.Renderer

func (Renderer) Extensions

func (Renderer) Extensions() []string

Extensions implements markup.Renderer

func (Renderer) Name

func (Renderer) Name() string

Name implements markup.Renderer

func (Renderer) NeedPostProcess

func (Renderer) NeedPostProcess() bool

NeedPostProcess implements markup.PostProcessRenderer

func (Renderer) Render

func (Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error

Render implements markup.Renderer

func (Renderer) SanitizerRules

func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule

SanitizerRules implements markup.Renderer

type Summary

type Summary struct {
	ast.BaseBlock
}

Summary is a block that contains the summary of details block

func NewSummary

func NewSummary() *Summary

NewSummary returns a new Summary node.

func (*Summary) Dump

func (n *Summary) Dump(source []byte, level int)

Dump implements Node.Dump .

func (*Summary) Kind

func (n *Summary) Kind() ast.NodeKind

Kind implements Node.Kind.

type TaskCheckBoxListItem

type TaskCheckBoxListItem struct {
	*ast.ListItem
	IsChecked      bool
	SourcePosition int
}

TaskCheckBoxListItem is a block that represents a list item of a markdown block with a checkbox

func NewTaskCheckBoxListItem

func NewTaskCheckBoxListItem(listItem *ast.ListItem) *TaskCheckBoxListItem

NewTaskCheckBoxListItem returns a new TaskCheckBoxListItem node.

func (*TaskCheckBoxListItem) Dump

func (n *TaskCheckBoxListItem) Dump(source []byte, level int)

Dump implements Node.Dump .

func (*TaskCheckBoxListItem) Kind

func (n *TaskCheckBoxListItem) Kind() ast.NodeKind

Kind implements Node.Kind.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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