1// Package blackfriday is a markdown processor. 2// 3// It translates plain text with simple formatting rules into an AST, which can 4// then be further processed to HTML (provided by Blackfriday itself) or other 5// formats (provided by the community). 6// 7// The simplest way to invoke Blackfriday is to call the Run function. It will 8// take a text input and produce a text output in HTML (or other format). 9// 10// A slightly more sophisticated way to use Blackfriday is to create a Markdown 11// processor and to call Parse, which returns a syntax tree for the input 12// document. You can leverage Blackfriday's parsing for content extraction from 13// markdown documents. You can assign a custom renderer and set various options 14// to the Markdown processor. 15// 16// If you're interested in calling Blackfriday from command line, see 17// https://github.com/russross/blackfriday-tool. 18// 19// Sanitized Anchor Names 20// 21// Blackfriday includes an algorithm for creating sanitized anchor names 22// corresponding to a given input text. This algorithm is used to create 23// anchors for headings when AutoHeadingIDs extension is enabled. The 24// algorithm is specified below, so that other packages can create 25// compatible anchor names and links to those anchors. 26// 27// The algorithm iterates over the input text, interpreted as UTF-8, 28// one Unicode code point (rune) at a time. All runes that are letters (category L) 29// or numbers (category N) are considered valid characters. They are mapped to 30// lower case, and included in the output. All other runes are considered 31// invalid characters. Invalid characters that precede the first valid character, 32// as well as invalid character that follow the last valid character 33// are dropped completely. All other sequences of invalid characters 34// between two valid characters are replaced with a single dash character '-'. 35// 36// SanitizedAnchorName exposes this functionality, and can be used to 37// create compatible links to the anchor names generated by blackfriday. 38// This algorithm is also implemented in a small standalone package at 39// github.com/shurcooL/sanitized_anchor_name. It can be useful for clients 40// that want a small package and don't need full functionality of blackfriday. 41package blackfriday 42 43// NOTE: Keep Sanitized Anchor Name algorithm in sync with package 44// github.com/shurcooL/sanitized_anchor_name. 45// Otherwise, users of sanitized_anchor_name will get anchor names 46// that are incompatible with those generated by blackfriday. 47