Documentation
¶
Index ¶
- Constants
- func BoldText(haystack, needle string) string
- func GeneratedAt(layout string, dt time.Time, locs []*time.Location) string
- func GeneratedAtLocationStrings(layout string, dt time.Time, locNames []string) (string, error)
- func GeneratedAtLocationStringsHuman(dt time.Time, locNames []string) (string, error)
- func Linkify(url, text string) string
- func NormalizeHeaders(content string, targetLevel int) string
- func ParseLink(s string) (string, string)
- func ShiftHeaders(content string, offset int) string
- func SkypeToMarkdown(input string, stripURLAutoLink bool) string
- func TableAlign(input string, sepLineRowIdx int) string
- func TableRowToMarkdown(cells []string, esc bool) string
- func TableRowsToMarkdown(rows [][]string, newline string, esc, withHeader bool) string
- func TableSeparator(cellCount int) string
- func URLToMarkdownLinkHostname(url string) string
- type Link
- type Links
Constants ¶
const ( GFMTableSep = "|" GFMTableSepStart = GFMTableSep + " " GFMTableSepMid = " " + GFMTableSep + " " GFMTableSepEnd = " " + GFMTableSep )
Variables ¶
This section is empty.
Functions ¶
func BoldText ¶
BoldText bodifies the identified text. It looks for start of words using a word boundary and will arbirarily end to match words with different suffixes.
func GeneratedAt ¶ added in v0.71.10
func GeneratedAtLocationStrings ¶ added in v0.71.10
func GeneratedAtLocationStringsHuman ¶ added in v0.71.10
func Linkify ¶
Linkify constructs a link from url and text inputs. This function does not handle escaping so it should be done before hand, e.g. using `\[` instead of `[` by itself in the `text`.
func NormalizeHeaders ¶ added in v0.74.10
NormalizeHeaders shifts headers so the highest level becomes targetLevel. For example, if content has # and ##, and targetLevel=3, they become ### and ####. If the content has no headers, it is returned unchanged. Lines inside fenced code blocks are not considered or modified.
func ShiftHeaders ¶ added in v0.74.10
ShiftHeaders adjusts all markdown headers by the specified offset. offset=1 converts # to ##, ## to ###, etc. offset=-1 converts ## to #, ### to ##, etc. Headers exceeding H6 are capped at H6. Headers that would go below H1 are capped at H1. Lines inside fenced code blocks (``` or ~~~) are not modified.
func SkypeToMarkdown ¶
SkypeToMarkdown converts Skype markup to Markdown. This is specifically useful for converting Slack messages to Markdown. The `stripURLAutoLink` parameter will remove links when they are within 3 backticks and the link innerHTML and URL match. Default is `true`.
func TableAlign ¶ added in v0.70.22
TableAlign takes a markdown table string and aligns the pipes.