{"modulePath":"github.com/stackdocker/gogs","version":"v0.9.13","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package markdown\n\n## Variables\n\n```go\nvar (\n\t// MentionPattern matches string that mentions someone, e.g. @Unknwon\n\tMentionPattern = regexp.MustCompile(`(\\s|^)@[0-9a-zA-Z_\\.]+`)\n\n\t// CommitPattern matches link to certain commit with or without trailing hash,\n\t// e.g. https://try.gogs.io/gogs/gogs/commit/d8a994ef243349f321568f9e36d5c3f444b99cae#diff-2\n\tCommitPattern = regexp.MustCompile(`(\\s|^)https?.*commit/[0-9a-zA-Z]+(#+[0-9a-zA-Z-]*)?`)\n\n\t// IssueFullPattern matches link to an issue with or without trailing hash,\n\t// e.g. https://try.gogs.io/gogs/gogs/issues/4#issue-685\n\tIssueFullPattern = regexp.MustCompile(`(\\s|^)https?.*issues/[0-9]+(#+[0-9a-zA-Z-]*)?`)\n\t// IssueIndexPattern matches string that references to an issue, e.g. #1287\n\tIssueIndexPattern = regexp.MustCompile(`( |^|\\()#[0-9]+\\b`)\n\n\t// Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae\n\tSha1CurrentPattern = regexp.MustCompile(`\\b[0-9a-f]{40}\\b`)\n)\n```\n\n```go\nvar Sanitizer = bluemonday.UGCPolicy()\n```\n\n## Functions\n\n```go\nfunc BuildSanitizer()\n```\nBuildSanitizer initializes sanitizer with allowed attributes based on settings. This function should only be called once during entire application lifecycle.\n\n```go\nfunc IsMarkdownFile(name string) bool\n```\nIsMarkdownFile reports whether name looks like a Markdown file based on its extension.\n\n```go\nfunc IsReadmeFile(name string) bool\n```\nIsReadmeFile reports whether name looks like a README file based on its extension.\n\n```go\nfunc PostProcess(rawHtml []byte, urlPrefix string, metas map[string]string) []byte\n```\nPostProcess treats different types of HTML differently, and only renders special links for plain text blocks.\n\n```go\nfunc Render(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\nRender renders Markdown to HTML with special links.\n\n```go\nfunc RenderIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\nRenderIssueIndexPattern renders issue indexes to corresponding links.\n\n```go\nfunc RenderRaw(body []byte, urlPrefix string) []byte\n```\nRenderRaw renders Markdown to HTML without handling special links.\n\n```go\nfunc RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte\n```\nRenderSha1CurrentPattern renders SHA1 strings to corresponding links that assumes in the same repository.\n\n```go\nfunc RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\nRenderSpecialLink renders mentions, indexes and SHA1 strings to corresponding links.\n\n```go\nfunc RenderString(raw, urlPrefix string, metas map[string]string) string\n```\nRenderString renders Markdown to HTML with special links and returns string type.\n\n## Types\n\n```go\ntype Renderer struct {\n\tblackfriday.Renderer\n\t// contains filtered or unexported fields\n}\n```\nRenderer is a extended version of underlying render object.\n\n```go\nfunc (r *Renderer) AutoLink(out *bytes.Buffer, link []byte, kind int)\n```\nAutoLink defines how auto-detected links should be processed to produce corresponding HTML elements. Reference for kind: [https://github.com/russross/blackfriday/blob/master/markdown.go#L69-L76](https://github.com/russross/blackfriday/blob/master/markdown.go#L69-L76)\n\n```go\nfunc (r *Renderer) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte)\n```\nImage defines how images should be processed to produce corresponding HTML elements.\n\n```go\nfunc (r *Renderer) Link(out *bytes.Buffer, link []byte, title []byte, content []byte)\n```\nLink defines how formal links should be processed to produce corresponding HTML elements.\n\n```go\nfunc (options *Renderer) ListItem(out *bytes.Buffer, text []byte, flags int)\n```\nListItem defines how list items should be processed to produce corresponding HTML elements.\n\n","path":"github.com/stackdocker/gogs/modules/markdown","name":"markdown","synopsis":"","isRedistributable":true}
