{"modulePath":"github.com/RedAFD/code-core","version":"v1.2.3","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package markdown\n\n## Constants\n\n```go\nconst (\n\tIssueNameStyleNumeric      = \"numeric\"\n\tIssueNameStyleAlphanumeric = \"alphanumeric\"\n)\n```\nIssue name styles\n\n## Variables\n\n```go\nvar (\n\n\t// MentionPattern matches string that mentions someone, e.g. @Unknwon\n\tMentionPattern = regexp.MustCompile(`(\\s|^|\\W)@[0-9a-zA-Z-_\\.]+`)\n\n\t// IssueNumericPattern matches string that references to a numeric issue, e.g. #1287\n\tIssueNumericPattern = regexp.MustCompile(`( |^|\\()#[0-9]+\\b`)\n\t// IssueAlphanumericPattern matches string that references to an alphanumeric issue, e.g. ABC-1234\n\tIssueAlphanumericPattern = regexp.MustCompile(`( |^|\\()[A-Z]{1,10}-[1-9][0-9]*\\b`)\n\t// CrossReferenceIssueNumericPattern matches string that references a numeric issue in a different repository\n\t// e.g. gogits/gogs#12345\n\tCrossReferenceIssueNumericPattern = regexp.MustCompile(`( |^)[0-9a-zA-Z]+/[0-9a-zA-Z]+#[0-9]+\\b`)\n\n\t// Sha1CurrentPattern matches string that represents a commit SHA, e.g. d8a994ef243349f321568f9e36d5c3f444b99cae\n\t// Although SHA1 hashes are 40 chars long, the regex matches the hash from 7 to 40 chars in length\n\t// so that abbreviated hash links can be used as well. This matches git and github useability.\n\tSha1CurrentPattern = regexp.MustCompile(`(?:^|\\s|\\()([0-9a-f]{7,40})\\b`)\n\n\t// ShortLinkPattern matches short but difficult to parse [[name|link|arg=test]] syntax\n\tShortLinkPattern = regexp.MustCompile(`(\\[\\[.*?\\]\\]\\w*)`)\n\n\t// AnySHA1Pattern allows to split url containing SHA into parts\n\tAnySHA1Pattern = regexp.MustCompile(`(http\\S*)://(\\S+)/(\\S+)/(\\S+)/(\\S+)/([0-9a-f]{40})(?:/?([^#\\s]+)?(?:#(\\S+))?)?`)\n)\n```\n\n```go\nvar (\n\t// MarkupName describes markup's name\n\tMarkupName = \"markdown\"\n)\n```\n\n## Functions\n\n```go\nfunc FindAllMentions(content string) []string\n```\nFindAllMentions matches mention patterns in given content and returns a list of found user names without @ prefix.\n\n```go\nfunc InitMarkdown()\n```\nInitMarkdown initialize regexps for markdown parsing\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 IsSameDomain(s string) bool\n```\nIsSameDomain checks if given url string has the same hostname as current Gitea instance\n\n```go\nfunc NewSanitizer()\n```\nNewSanitizer initializes sanitizer with allowed attributes based on settings. Multiple calls to this function will only create one instance of Sanitizer during entire application lifecycle.\n\n```go\nfunc PostProcess(rawHTML []byte, urlPrefix string, metas map[string]string, isWikiMarkdown bool) []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 all specific handling stuff.\n\n```go\nfunc RenderCrossReferenceIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\nRenderCrossReferenceIssueIndexPattern renders issue indexes from other repositories to corresponding links.\n\n```go\nfunc RenderFullIssuePattern(rawBytes []byte) []byte\n```\nRenderFullIssuePattern renders issues-like URLs\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, wikiMarkdown bool) []byte\n```\nRenderRaw renders Markdown to HTML without handling special links.\n\n```go\nfunc RenderShortLinks(rawBytes []byte, urlPrefix string, noLink bool, isWikiMarkdown bool) []byte\n```\nRenderShortLinks processes \\[\\[syntax]]\n\nnoLink flag disables making link tags when set to true so this function just replaces the whole \\[\\[...]] with the content text\n\nisWikiMarkdown is a flag to choose linking url prefix\n\n```go\nfunc RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]string, isWikiMarkdown bool) []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```go\nfunc RenderWiki(rawBytes []byte, urlPrefix string, metas map[string]string) string\n```\nRenderWiki renders markdown wiki page to HTML and return HTML string\n\n```go\nfunc Sanitize(s string) string\n```\nSanitize takes a string that contains a HTML fragment or document and applies policy whitelist.\n\n```go\nfunc SanitizeBytes(b []byte) []byte\n```\nSanitizeBytes takes a \\[]byte slice that contains a HTML fragment or document and applies policy whitelist.\n\n```go\nfunc URLJoin(base string, elems ...string) string\n```\nURLJoin joins url components, like path.Join, but preserving contents\n\n## Types\n\n```go\ntype Parser struct {\n}\n```\nParser implements markup.Parser\n\n```go\nfunc (Parser) Extensions() []string\n```\nExtensions implements markup.Parser\n\n```go\nfunc (Parser) Name() string\n```\nName implements markup.Parser\n\n```go\nfunc (Parser) Render(rawBytes []byte, urlPrefix string, metas map[string]string, isWiki bool) []byte\n```\nRender implements markup.Parser\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) 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 (r *Renderer) List(out *bytes.Buffer, text func() bool, flags int)\n```\nList renders markdown bullet or digit lists to HTML\n\n```go\nfunc (r *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```go\ntype Sanitizer struct {\n\t// contains filtered or unexported fields\n}\n```\nSanitizer is a protection wrapper of \\*bluemonday.Policy which does not allow any modification to the underlying policies once it's been created.\n\n","path":"github.com/RedAFD/code-core/modules/markdown","name":"markdown","synopsis":"","isRedistributable":true}
