slimdown

package module
v0.0.0-...-ea63846 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

README

golang-slimdown

This package allows a subset of Markdown to be compiled into HTML.

Information

The code is still a work in progress. Use at your own risk.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCompileTokenStackOverflow        = errors.New("token stack overflow") // unused
	ErrCompileTokenTypeUnknown          = errors.New("token type unknown")
	ErrCompileBackslashTransformUnknown = errors.New("backslash transform unknown")
)
View Source
var (
	DefaultOptions = Options{
		AllowHTML:                 false,
		CleanEmptyTags:            false,
		CleanEmptyTokens:          false,
		DebugPrintOutput:          false,
		DebugPrintTokens:          false,
		EnableBackslashTransforms: false,
		EnableBlockquotes:         false,
		EnableCodeTags:            true,
		EnableDocumentTags:        false,
		EnableEmTags:              true,
		EnableHeadings:            true,
		EnableHorizontalRules:     true,
		EnableHyphenTransforms:    true,
		EnableImages:              true,
		EnableLinks:               true,
		EnableLists:               true,
		EnableParagraphs:          true,
		EnableStrongTags:          true,
		MaxConsecutiveTabs:        0,
		MaxConsecutiveSpaces:      0,
		SpacesToTab:               0,
		TabToSpaces:               0,
	}
)

Functions

func Compile

func Compile(input []byte, options *Options) (output template.HTML, err error)

func CompileDefault

func CompileDefault(input []byte) (output template.HTML, err error)

func CompileString

func CompileString(input string, options *Options) (output template.HTML, err error)

func CompileStringDefault

func CompileStringDefault(input string) (output template.HTML, err error)

Types

type Options

type Options struct {
	AllowHTML                 bool
	CleanEmptyTags            bool
	CleanEmptyTokens          bool
	DebugPrintOutput          bool
	DebugPrintTokens          bool
	EnableBackslashTransforms bool
	EnableBlockquotes         bool
	EnableCodeTags            bool
	EnableDocumentTags        bool
	EnableEmTags              bool
	EnableHeadings            bool
	EnableHorizontalRules     bool
	EnableHyphenTransforms    bool
	EnableImages              bool
	EnableLinks               bool
	EnableLists               bool
	EnableMarkTags            bool
	EnableParagraphs          bool
	EnableStrongTags          bool
	MaxConsecutiveTabs        int
	MaxConsecutiveSpaces      int
	SpacesToTab               int
	TabToSpaces               int
	// contains filtered or unexported fields
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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