aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/render.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/markup/render.go')
-rw-r--r--modules/markup/render.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/markup/render.go b/modules/markup/render.go
index 37a2a86687..79f1f473c2 100644
--- a/modules/markup/render.go
+++ b/modules/markup/render.go
@@ -8,6 +8,7 @@ import (
"fmt"
"io"
"net/url"
+ "strconv"
"strings"
"time"
@@ -46,7 +47,7 @@ type RenderOptions struct {
// user&repo, format&style&regexp (for external issue pattern), teams&org (for mention)
// RefTypeNameSubURL (for iframe&asciicast)
// markupAllowShortIssuePattern
- // markdownLineBreakStyle (comment, document)
+ // markdownNewLineHardBreak
Metas map[string]string
// used by external render. the router "/org/repo/render/..." will output the rendered content in a standalone page
@@ -247,7 +248,8 @@ func Init(renderHelpFuncs *RenderHelperFuncs) {
}
func ComposeSimpleDocumentMetas() map[string]string {
- return map[string]string{"markdownLineBreakStyle": "document"}
+ // TODO: there is no separate config option for "simple document" rendering, so temporarily use the same config as "repo file"
+ return map[string]string{"markdownNewLineHardBreak": strconv.FormatBool(setting.Markdown.RenderOptionsRepoFile.NewLineHardBreak)}
}
type TestRenderHelper struct {
@@ -261,8 +263,14 @@ func (r *TestRenderHelper) IsCommitIDExisting(commitID string) bool {
return strings.HasPrefix(commitID, "65f1bf2") //|| strings.HasPrefix(commitID, "88fc37a")
}
-func (r *TestRenderHelper) ResolveLink(link string, likeType LinkType) string {
- return r.ctx.ResolveLinkRelative(r.BaseLink, "", link)
+func (r *TestRenderHelper) ResolveLink(link, preferLinkType string) string {
+ linkType, link := ParseRenderedLink(link, preferLinkType)
+ switch linkType {
+ case LinkTypeRoot:
+ return r.ctx.ResolveLinkRoot(link)
+ default:
+ return r.ctx.ResolveLinkRelative(r.BaseLink, "", link)
+ }
}
var _ RenderHelper = (*TestRenderHelper)(nil)