mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 20:16:20 +01:00
Merge pull request #2836 from odinuge/markdown-links-rebase
Fix relative links in markdown files
This commit is contained in:
commit
1f5bb08c25
1 changed files with 3 additions and 0 deletions
|
@ -159,6 +159,8 @@ var (
|
||||||
svgSuffixWithMark = []byte(".svg?")
|
svgSuffixWithMark = []byte(".svg?")
|
||||||
spaceBytes = []byte(" ")
|
spaceBytes = []byte(" ")
|
||||||
spaceEncodedBytes = []byte("%20")
|
spaceEncodedBytes = []byte("%20")
|
||||||
|
space = " "
|
||||||
|
spaceEncoded = "%20"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Image defines how images should be processed to produce corresponding HTML elements.
|
// Image defines how images should be processed to produce corresponding HTML elements.
|
||||||
|
@ -357,6 +359,7 @@ OUTER_LOOP:
|
||||||
|
|
||||||
// Render renders Markdown to HTML with special links.
|
// Render renders Markdown to HTML with special links.
|
||||||
func Render(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
|
func Render(rawBytes []byte, urlPrefix string, metas map[string]string) []byte {
|
||||||
|
urlPrefix = strings.Replace(urlPrefix, space, spaceEncoded, -1)
|
||||||
result := RenderRaw(rawBytes, urlPrefix)
|
result := RenderRaw(rawBytes, urlPrefix)
|
||||||
result = PostProcess(result, urlPrefix, metas)
|
result = PostProcess(result, urlPrefix, metas)
|
||||||
result = Sanitizer.SanitizeBytes(result)
|
result = Sanitizer.SanitizeBytes(result)
|
||||||
|
|
Loading…
Reference in a new issue