Documentation
¶
Index ¶
- func CMarkHTMLEscapeString(s string) string
- func CMarkStripHTMLForAltTag(s string) string
- func CMarkURLEncodeString(str string) string
- func GenerateFromBytes(commonmarkBytes []byte, generator CommonmarkGenerator) []byte
- func GenerateFromNode(node *commonmark.CMarkNode, generator CommonmarkGenerator) string
- func GenerateFromString(commonmarkString string, generator CommonmarkGenerator) string
- type CommonmarkGenerator
- type HtmlGenerator
- func (h *HtmlGenerator) GenBlockQuote(content string) string
- func (h *HtmlGenerator) GenCode(content string) string
- func (h *HtmlGenerator) GenCodeBlock(fenceInfo string, content string) string
- func (h *HtmlGenerator) GenDocument(content string) string
- func (h *HtmlGenerator) GenEmph(content string) string
- func (h *HtmlGenerator) GenHTML(content string) string
- func (h *HtmlGenerator) GenHeader(level int, content string) string
- func (h *HtmlGenerator) GenHrule() string
- func (h *HtmlGenerator) GenImage(imgUrl, alt, title string) string
- func (h *HtmlGenerator) GenInlineHTML(content string) string
- func (h *HtmlGenerator) GenItem(content string) string
- func (h *HtmlGenerator) GenLinebreak() string
- func (h *HtmlGenerator) GenLink(linkUrl, title, content string) string
- func (h *HtmlGenerator) GenList(numberedList bool, listStartNumber int, content string) string
- func (h *HtmlGenerator) GenParagraph(inTightList bool, content string) string
- func (h *HtmlGenerator) GenSoftbreak() string
- func (h *HtmlGenerator) GenStrong(content string) string
- func (h *HtmlGenerator) GenText(content string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CMarkHTMLEscapeString ¶
CMarkHTMLEscapeString escapes the supplied string using the commonmark HTML escaping rules.
func CMarkStripHTMLForAltTag ¶
CMarkStripHTMLForAltTag stripts HTML from text, making it suitable for use in an alt tag. Not very pretty code at all.
func CMarkURLEncodeString ¶
CMarkURLEncodeString escapes the supplied string using the commonmark HTML escaping rules. HACK HACK Commonmark encoding is weird. This code is dumb and not complete. Placeholder until we can get something better
func GenerateFromBytes ¶
func GenerateFromBytes(commonmarkBytes []byte, generator CommonmarkGenerator) []byte
GenerateFromBytes generates output for the supplied byte array (containing commonmark text), using the supplied generator.
func GenerateFromNode ¶
func GenerateFromNode(node *commonmark.CMarkNode, generator CommonmarkGenerator) string
GenerateFromNode generates output for the supplied commonmark node using the supplied generator.
func GenerateFromString ¶
func GenerateFromString(commonmarkString string, generator CommonmarkGenerator) string
GenerateFromString generates output for the supplied string (containing commonmark text), using the supplied generator.
Types ¶
type CommonmarkGenerator ¶
type CommonmarkGenerator interface { // blocks GenBlockQuote(content string) string GenList(numberedList bool, listStartNumber int, content string) string GenItem(content string) string GenCodeBlock(fenceInfo string, content string) string GenHTML(content string) string GenParagraph(inTightList bool, content string) string GenHeader(level int, content string) string GenHrule() string // inlines GenText(content string) string GenSoftbreak() string GenLinebreak() string GenCode(content string) string GenInlineHTML(content string) string GenEmph(content string) string GenStrong(content string) string GenLink(linkURL, title, content string) string GenImage(imgURL, alt, title string) string // helpers GenDocument(content string) string }
CommonmarkGenerator is the interface needs to be implemented by every output generator. Each of these methods will be called as the particular commonmark element is found in the input document.
type HtmlGenerator ¶
type HtmlGenerator struct { }
HtmlGenerator is an example generator that generates commonmark compliant HTML.
func NewHtmlGenerator ¶
func NewHtmlGenerator() *HtmlGenerator
func (*HtmlGenerator) GenBlockQuote ¶
func (h *HtmlGenerator) GenBlockQuote(content string) string
func (*HtmlGenerator) GenCode ¶
func (h *HtmlGenerator) GenCode(content string) string
func (*HtmlGenerator) GenCodeBlock ¶
func (h *HtmlGenerator) GenCodeBlock(fenceInfo string, content string) string
func (*HtmlGenerator) GenDocument ¶
func (h *HtmlGenerator) GenDocument(content string) string
func (*HtmlGenerator) GenEmph ¶
func (h *HtmlGenerator) GenEmph(content string) string
func (*HtmlGenerator) GenHTML ¶
func (h *HtmlGenerator) GenHTML(content string) string
func (*HtmlGenerator) GenHeader ¶
func (h *HtmlGenerator) GenHeader(level int, content string) string
func (*HtmlGenerator) GenHrule ¶
func (h *HtmlGenerator) GenHrule() string
func (*HtmlGenerator) GenImage ¶
func (h *HtmlGenerator) GenImage(imgUrl, alt, title string) string
func (*HtmlGenerator) GenInlineHTML ¶
func (h *HtmlGenerator) GenInlineHTML(content string) string
func (*HtmlGenerator) GenItem ¶
func (h *HtmlGenerator) GenItem(content string) string
func (*HtmlGenerator) GenLinebreak ¶
func (h *HtmlGenerator) GenLinebreak() string
func (*HtmlGenerator) GenLink ¶
func (h *HtmlGenerator) GenLink(linkUrl, title, content string) string
func (*HtmlGenerator) GenList ¶
func (h *HtmlGenerator) GenList(numberedList bool, listStartNumber int, content string) string
func (*HtmlGenerator) GenParagraph ¶
func (h *HtmlGenerator) GenParagraph(inTightList bool, content string) string
func (*HtmlGenerator) GenSoftbreak ¶
func (h *HtmlGenerator) GenSoftbreak() string
func (*HtmlGenerator) GenStrong ¶
func (h *HtmlGenerator) GenStrong(content string) string
func (*HtmlGenerator) GenText ¶
func (h *HtmlGenerator) GenText(content string) string