const Version … type Extensions … const NoExtensions … const NoIntraEmphasis … const Tables … const FencedCode … const Autolink … const Strikethrough … const LaxHTMLBlocks … const SpaceHeadings … const HardLineBreak … const TabSizeEight … const Footnotes … const NoEmptyLineBeforeBlock … const HeadingIDs … const Titleblock … const AutoHeadingIDs … const BackslashLineBreak … const DefinitionLists … const CommonHTMLFlags … const CommonExtensions … type ListType … const ListTypeOrdered … const ListTypeDefinition … const ListTypeTerm … const ListItemContainsBlock … const ListItemBeginningOfList … const ListItemEndOfList … type CellAlignFlags … const TableAlignmentLeft … const TableAlignmentRight … const TableAlignmentCenter … const TabSizeDefault … const TabSizeDouble … var blockTags … type Renderer … type inlineParser … type Markdown … func (p *Markdown) getRef(refid string) (ref *reference, found bool) { … } func (p *Markdown) finalize(block *Node) { … } func (p *Markdown) addChild(node NodeType, offset uint32) *Node { … } func (p *Markdown) addExistingChild(node *Node, offset uint32) *Node { … } func (p *Markdown) closeUnmatchedBlocks() { … } type Reference … type ReferenceOverrideFunc … // New constructs a Markdown processor. You can use the same With* functions as // for Run() to customize parser's behavior and the renderer. func New(opts ...Option) *Markdown { … } type Option … // WithRenderer allows you to override the default renderer. func WithRenderer(r Renderer) Option { … } // WithExtensions allows you to pick some of the many extensions provided by // Blackfriday. You can bitwise OR them. func WithExtensions(e Extensions) Option { … } // WithNoExtensions turns off all extensions and custom behavior. func WithNoExtensions() Option { … } // WithRefOverride sets an optional function callback that is called every // time a reference is resolved. // // In Markdown, the link reference syntax can be made to resolve a link to // a reference instead of an inline URL, in one of the following ways: // // * [link text][refid] // * [refid][] // // Usually, the refid is defined at the bottom of the Markdown document. If // this override function is provided, the refid is passed to the override // function first, before consulting the defined refids at the bottom. If // the override function indicates an override did not occur, the refids at // the bottom will be used to fill in the link details. func WithRefOverride(o ReferenceOverrideFunc) Option { … } // Run is the main entry point to Blackfriday. It parses and renders a // block of markdown-encoded text. // // The simplest invocation of Run takes one argument, input: // output := Run(input) // This will parse the input with CommonExtensions enabled and render it with // the default HTMLRenderer (with CommonHTMLFlags). // // Variadic arguments opts can customize the default behavior. Since Markdown // type does not contain exported fields, you can not use it directly. Instead, // use the With* functions. For example, this will call the most basic // functionality, with no extensions: // output := Run(input, WithNoExtensions()) // // You can use any number of With* arguments, even contradicting ones. They // will be applied in order of appearance and the latter will override the // former: // output := Run(input, WithNoExtensions(), WithExtensions(exts), // WithRenderer(yourRenderer)) func Run(input []byte, opts ...Option) []byte { … } // Parse is an entry point to the parsing part of Blackfriday. It takes an // input markdown document and produces a syntax tree for its contents. This // tree can then be rendered with a default or custom renderer, or // analyzed/transformed by the caller to whatever non-standard needs they have. // The return value is the root node of the syntax tree. func (p *Markdown) Parse(input []byte) *Node { … } func (p *Markdown) parseRefsToAST() { … } type reference … func (r *reference) String() string { … } // Check whether or not data starts with a reference link. // If so, it is parsed and stored in the list of references // (in the render struct). // Returns the number of bytes to skip to move past it, // or zero if the first line is not a reference. func isReference(p *Markdown, data []byte, tabSize int) int { … } func scanLinkRef(p *Markdown, data []byte, i int) (linkOffset, linkEnd, titleOffset, titleEnd, lineEnd int) { … } // The first bit of this logic is the same as Parser.listItem, but the rest // is much simpler. This function simply finds the entire block and shifts it // over by one tab if it is indeed a block (just returns the line if it's not). // blockEnd is the end of the section in the input buffer, and contents is the // extracted text that was shifted over one tab. It will need to be rendered at // the end of the document. func scanFootnote(p *Markdown, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) { … } // Test if a character is a punctuation symbol. // Taken from a private function in regexp in the stdlib. func ispunct(c byte) bool { … } // Test if a character is a whitespace character. func isspace(c byte) bool { … } // Test if a character is a horizontal whitespace character. func ishorizontalspace(c byte) bool { … } // Test if a character is a vertical character. func isverticalspace(c byte) bool { … } // Test if a character is letter. func isletter(c byte) bool { … } // Test if a character is a letter or a digit. // TODO: check when this is looking for ASCII alnum and when it should use unicode func isalnum(c byte) bool { … } // Replace tab characters with spaces, aligning to the next TAB_SIZE column. // always ends output with a newline func expandTabs(out *bytes.Buffer, line []byte, tabSize int) { … } // Find if a line counts as indented or not. // Returns number of characters the indent is (0 = not indented). func isIndented(data []byte, indentSize int) int { … } // Create a url-safe slug for fragments func slugify(in []byte) []byte { … }