@@ -5,6 +5,8 @@ package markup
55
66import (
77 "bytes"
8+ "fmt"
9+ "html/template"
810 "io"
911 "regexp"
1012 "strings"
@@ -196,13 +198,6 @@ func RenderCommitMessage(
196198 content string ,
197199) (string , error ) {
198200 procs := commitMessageProcessors
199- if ctx .DefaultLink != "" {
200- // we don't have to fear data races, because being
201- // commitMessageProcessors of fixed len and cap, every time we append
202- // something to it the slice is realloc+copied, so append always
203- // generates the slice ex-novo.
204- procs = append (procs , genDefaultLinkProcessor (ctx .DefaultLink ))
205- }
206201 return renderProcessString (ctx , procs , content )
207202}
208203
@@ -230,17 +225,17 @@ var emojiProcessors = []processor{
230225// which changes every text node into a link to the passed default link.
231226func RenderCommitMessageSubject (
232227 ctx * RenderContext ,
233- content string ,
228+ defaultLink , content string ,
234229) (string , error ) {
235230 procs := commitMessageSubjectProcessors
236- if ctx .DefaultLink != "" {
237- // we don't have to fear data races, because being
238- // commitMessageSubjectProcessors of fixed len and cap, every time we
239- // append something to it the slice is realloc+copied, so append always
240- // generates the slice ex-novo.
241- procs = append (procs , genDefaultLinkProcessor (ctx .DefaultLink ))
231+ rendered , err := renderProcessString (ctx , procs , content )
232+ if err != nil {
233+ return "" , err
242234 }
243- return renderProcessString (ctx , procs , content )
235+ if defaultLink != "" {
236+ rendered = fmt .Sprintf (`<a href="%s" class="muted">%s</a>` , template .HTMLEscapeString (defaultLink ), rendered )
237+ }
238+ return rendered , nil
244239}
245240
246241// RenderIssueTitle to process title on individual issue/pull page
0 commit comments