forked from forgejo/forgejo
Rework special link parsing in the post-processing of markup (#3354)
* Get rid of autolink * autolink in markdown * Replace email addresses with mailto links * better handling of links * Remove autolink.js from footer * Refactor entire html.go * fix some bugs * Make tests green, move what we can to html_internal_test, various other changes to processor logic * Make markdown tests work again This is just a description to allow me to force push in order to restart the drone build. * Fix failing markdown tests in routers/api/v1/misc * Add license headers, log errors, future-proof <body> * fix formatting
This commit is contained in:
parent
769ab1e424
commit
535445c32e
12 changed files with 1029 additions and 1025 deletions
|
@ -7,6 +7,8 @@ package markup
|
|||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
)
|
||||
|
||||
// Init initialize regexps for markdown parsing
|
||||
|
@ -69,7 +71,11 @@ func RenderWiki(filename string, rawBytes []byte, urlPrefix string, metas map[st
|
|||
func render(parser Parser, rawBytes []byte, urlPrefix string, metas map[string]string, isWiki bool) []byte {
|
||||
urlPrefix = strings.Replace(urlPrefix, " ", "+", -1)
|
||||
result := parser.Render(rawBytes, urlPrefix, metas, isWiki)
|
||||
result = PostProcess(result, urlPrefix, metas, isWiki)
|
||||
// TODO: one day the error should be returned.
|
||||
result, err := PostProcess(result, urlPrefix, metas, isWiki)
|
||||
if err != nil {
|
||||
log.Error(3, "PostProcess: %v", err)
|
||||
}
|
||||
return SanitizeBytes(result)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue