Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractMetadata(contents string, out interface{}) (string, error)
- func ExtractMetadataBytes(contents []byte, out interface{}) ([]byte, error)
- func IsColorPreview(node ast.Node) bool
- func IsDetails(node ast.Node) bool
- func IsIcon(node ast.Node) bool
- func IsSummary(node ast.Node) bool
- func IsTaskCheckBoxListItem(node ast.Node) bool
- func NewHTMLRenderer(opts ...html.Option) renderer.NodeRenderer
- func Render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error
- func RenderRaw(ctx *markup.RenderContext, input io.Reader, output io.Writer) error
- func RenderRawString(ctx *markup.RenderContext, content string) (string, error)
- func RenderString(ctx *markup.RenderContext, content string) (string, error)
- func SpecializedMarkdown() goldmark.Markdown
- type ASTTransformer
- type Attention
- type ColorPreview
- type Details
- type HTMLRenderer
- type Icon
- type RenderConfig
- type Renderer
- type Summary
- type TaskCheckBoxListItem
Constants ¶
const ( AttentionNote string = "Note" AttentionWarning string = "Warning" )
Variables ¶
var KindAttention = ast.NewNodeKind("Attention")
KindAttention is the NodeKind for Attention
var KindColorPreview = ast.NewNodeKind("ColorPreview")
KindColorPreview is the NodeKind for ColorPreview
var KindDetails = ast.NewNodeKind("Details")
KindDetails is the NodeKind for Details
var KindIcon = ast.NewNodeKind("Icon")
KindIcon is the NodeKind for Icon
var KindSummary = ast.NewNodeKind("Summary")
KindSummary is the NodeKind for Summary
var KindTaskCheckBoxListItem = ast.NewNodeKind("TaskCheckBoxListItem")
KindTaskCheckBoxListItem is the NodeKind for TaskCheckBoxListItem
var MarkupName = "markdown"
MarkupName describes markup's name
Functions ¶
func ExtractMetadata ¶
ExtractMetadata consumes a markdown file, parses YAML frontmatter, and returns the frontmatter metadata separated from the markdown content
func ExtractMetadataBytes ¶
ExtractMetadata consumes a markdown file, parses YAML frontmatter, and returns the frontmatter metadata separated from the markdown content
func IsColorPreview ¶
IsColorPreview returns true if the given node implements the ColorPreview interface, otherwise false.
func IsDetails ¶
IsDetails returns true if the given node implements the Details interface, otherwise false.
func IsSummary ¶
IsSummary returns true if the given node implements the Summary interface, otherwise false.
func IsTaskCheckBoxListItem ¶
IsTaskCheckBoxListItem returns true if the given node implements the TaskCheckBoxListItem interface, otherwise false.
func NewHTMLRenderer ¶
func NewHTMLRenderer(opts ...html.Option) renderer.NodeRenderer
NewHTMLRenderer creates a HTMLRenderer to render in the gitea form.
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) (string, error)
RenderString renders Markdown string to HTML with all specific handling stuff and return string
func SpecializedMarkdown ¶
SpecializedMarkdown sets up the Gitea specific markdown extensions
Types ¶
type ASTTransformer ¶
type ASTTransformer struct{}
ASTTransformer is a default transformer of the goldmark tree.
type Attention ¶
type Attention struct { ast.BaseInline AttentionType string }
Attention is an inline for a color preview
func NewAttention ¶
NewAttention returns a new Attention node.
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.
type HTMLRenderer ¶
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 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 ¶
Extensions implements markup.Renderer
func (Renderer) NeedPostProcess ¶
NeedPostProcess implements markup.PostProcessRenderer
func (Renderer) SanitizerRules ¶
func (Renderer) SanitizerRules() []setting.MarkupSanitizerRule
SanitizerRules implements markup.Renderer
type TaskCheckBoxListItem ¶
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.