diff --git a/modules/templates/helper.go b/modules/templates/helper.go
index 4ffd0a5dee03b..b7bd07670cf74 100644
--- a/modules/templates/helper.go
+++ b/modules/templates/helper.go
@@ -174,8 +174,9 @@ func NewFuncMap() []template.FuncMap {
"RenderEmojiPlain": emoji.ReplaceAliases,
"ReactionToEmoji": ReactionToEmoji,
"RenderNote": RenderNote,
- "RenderMarkdownToHtml": func(input string) template.HTML {
+ "RenderMarkdownToHtml": func(ctx context.Context, input string) template.HTML {
output, err := markdown.RenderString(&markup.RenderContext{
+ Ctx: ctx,
URLPrefix: setting.AppSubURL,
}, input)
if err != nil {
diff --git a/templates/package/content/cargo.tmpl b/templates/package/content/cargo.tmpl
index f78647ca69c63..410a81d9017a9 100644
--- a/templates/package/content/cargo.tmpl
+++ b/templates/package/content/cargo.tmpl
@@ -26,7 +26,7 @@ git-fetch-with-cli = true
{{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}}
{{if .PackageDescriptor.Metadata.Description}}{{.PackageDescriptor.Metadata.Description}}
{{end}}
- {{if .PackageDescriptor.Metadata.Readme}}{{RenderMarkdownToHtml .PackageDescriptor.Metadata.Readme}}
{{end}}
+ {{if .PackageDescriptor.Metadata.Readme}}{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}
{{end}}
{{end}}
{{if .PackageDescriptor.Metadata.Dependencies}}
diff --git a/templates/package/content/chef.tmpl b/templates/package/content/chef.tmpl
index edc175f9beddc..d80ecdf40317a 100644
--- a/templates/package/content/chef.tmpl
+++ b/templates/package/content/chef.tmpl
@@ -20,7 +20,7 @@
{{if .PackageDescriptor.Metadata.Description}}
{{.PackageDescriptor.Metadata.Description}}
{{end}}
- {{if .PackageDescriptor.Metadata.LongDescription}}{{RenderMarkdownToHtml .PackageDescriptor.Metadata.LongDescription}}{{end}}
+ {{if .PackageDescriptor.Metadata.LongDescription}}{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}}{{end}}
{{end}}
diff --git a/templates/package/content/npm.tmpl b/templates/package/content/npm.tmpl
index ea514c5263ad9..d0c037b38a6d7 100644
--- a/templates/package/content/npm.tmpl
+++ b/templates/package/content/npm.tmpl
@@ -25,7 +25,7 @@
{{if .PackageDescriptor.Metadata.Readme}}
- {{RenderMarkdownToHtml .PackageDescriptor.Metadata.Readme}}
+ {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}
{{else if .PackageDescriptor.Metadata.Description}}
{{.PackageDescriptor.Metadata.Description}}
diff --git a/templates/package/content/pub.tmpl b/templates/package/content/pub.tmpl
index e81439d4daece..d5676fca5a5de 100644
--- a/templates/package/content/pub.tmpl
+++ b/templates/package/content/pub.tmpl
@@ -14,6 +14,6 @@
{{if or .PackageDescriptor.Metadata.Description .PackageDescriptor.Metadata.Readme}}
{{if .PackageDescriptor.Metadata.Description}}
{{.PackageDescriptor.Metadata.Description}}
{{end}}
- {{if .PackageDescriptor.Metadata.Readme}}
{{RenderMarkdownToHtml .PackageDescriptor.Metadata.Readme}}
{{end}}
+ {{if .PackageDescriptor.Metadata.Readme}}
{{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Readme}}
{{end}}
{{end}}
{{end}}
diff --git a/templates/package/content/pypi.tmpl b/templates/package/content/pypi.tmpl
index 830ba9bd67e54..8dbed5395ebd0 100644
--- a/templates/package/content/pypi.tmpl
+++ b/templates/package/content/pypi.tmpl
@@ -16,9 +16,9 @@
{{if .PackageDescriptor.Metadata.Summary}}{{.PackageDescriptor.Metadata.Summary}}{{end}}
{{if .PackageDescriptor.Metadata.LongDescription}}
- {{RenderMarkdownToHtml .PackageDescriptor.Metadata.LongDescription}}
+ {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.LongDescription}}
{{else if .PackageDescriptor.Metadata.Description}}
- {{RenderMarkdownToHtml .PackageDescriptor.Metadata.Description}}
+ {{RenderMarkdownToHtml $.Context .PackageDescriptor.Metadata.Description}}
{{end}}
{{end}}
diff --git a/templates/repo/issue/comment_tab.tmpl b/templates/repo/issue/comment_tab.tmpl
index 86efa8c833b07..b04a3c6bbbb4e 100644
--- a/templates/repo/issue/comment_tab.tmpl
+++ b/templates/repo/issue/comment_tab.tmpl
@@ -2,15 +2,15 @@
{{range .Fields}}
{{if eq .Type "input"}}
- {{template "repo/issue/fields/input" .}}
+ {{template "repo/issue/fields/input" Dict "Context" $.Context "item" .}}
{{else if eq .Type "markdown"}}
- {{template "repo/issue/fields/markdown" .}}
+ {{template "repo/issue/fields/markdown" Dict "Context" $.Context "item" .}}
{{else if eq .Type "textarea"}}
- {{template "repo/issue/fields/textarea" .}}
+ {{template "repo/issue/fields/textarea" Dict "Context" $.Context "item" .}}
{{else if eq .Type "dropdown"}}
- {{template "repo/issue/fields/dropdown" .}}
+ {{template "repo/issue/fields/dropdown" Dict "Context" $.Context "item" .}}
{{else if eq .Type "checkboxes"}}
- {{template "repo/issue/fields/checkboxes" .}}
+ {{template "repo/issue/fields/checkboxes" Dict "Context" $.Context "item" .}}
{{end}}
{{end}}
{{else}}
diff --git a/templates/repo/issue/fields/checkboxes.tmpl b/templates/repo/issue/fields/checkboxes.tmpl
index b70334681f22f..80835b649a50a 100644
--- a/templates/repo/issue/fields/checkboxes.tmpl
+++ b/templates/repo/issue/fields/checkboxes.tmpl
@@ -1,7 +1,7 @@
{{template "repo/issue/fields/header" .}}
{{$field := .}}
- {{range $i, $opt := .Attributes.options}}
+ {{range $i, $opt := .item.Attributes.options}}
diff --git a/templates/repo/issue/fields/dropdown.tmpl b/templates/repo/issue/fields/dropdown.tmpl
index 83c2bb4aac89e..9adce5602f9a8 100644
--- a/templates/repo/issue/fields/dropdown.tmpl
+++ b/templates/repo/issue/fields/dropdown.tmpl
@@ -1,12 +1,12 @@
{{template "repo/issue/fields/header" .}}
{{/* FIXME: required validation */}}
-
-
+
+
diff --git a/templates/repo/issue/fields/header.tmpl b/templates/repo/issue/fields/header.tmpl
index fb8511b4f0bd0..6034fed5fd23d 100644
--- a/templates/repo/issue/fields/header.tmpl
+++ b/templates/repo/issue/fields/header.tmpl
@@ -1,6 +1,6 @@
-{{if .Attributes.label}}
-
{{.Attributes.label}}{{if .Validations.required}}{{end}}
+{{if .item.Attributes.label}}
+
{{.item.Attributes.label}}{{if .item.Validations.required}}{{end}}
{{end}}
-{{if .Attributes.description}}
-
{{RenderMarkdownToHtml .Attributes.description}}
+{{if .item.Attributes.description}}
+
{{RenderMarkdownToHtml .Context .item.Attributes.description}}
{{end}}
diff --git a/templates/repo/issue/fields/input.tmpl b/templates/repo/issue/fields/input.tmpl
index d73354f6d392d..3fc8a8651048d 100644
--- a/templates/repo/issue/fields/input.tmpl
+++ b/templates/repo/issue/fields/input.tmpl
@@ -1,4 +1,4 @@
{{template "repo/issue/fields/header" .}}
-
+
diff --git a/templates/repo/issue/fields/markdown.tmpl b/templates/repo/issue/fields/markdown.tmpl
index 8236171523e0a..fd5b6afd227f7 100644
--- a/templates/repo/issue/fields/markdown.tmpl
+++ b/templates/repo/issue/fields/markdown.tmpl
@@ -1,3 +1,3 @@
-
{{RenderMarkdownToHtml .Attributes.value}}
+
{{RenderMarkdownToHtml .Context .item.Attributes.value}}
diff --git a/templates/repo/issue/fields/textarea.tmpl b/templates/repo/issue/fields/textarea.tmpl
index 5ad82e2460846..4b390fc9d6e08 100644
--- a/templates/repo/issue/fields/textarea.tmpl
+++ b/templates/repo/issue/fields/textarea.tmpl
@@ -2,5 +2,5 @@
{{template "repo/issue/fields/header" .}}
{{/* FIXME: preview markdown result */}}
{{/* FIXME: required validation for markdown editor */}}
-
+