File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -5,10 +5,9 @@ package markup
5
5
6
6
import (
7
7
"bytes"
8
- "fmt"
9
- "html/template"
10
8
"io"
11
9
"regexp"
10
+ "slices"
12
11
"strings"
13
12
"sync"
14
13
@@ -227,15 +226,16 @@ func RenderCommitMessageSubject(
227
226
ctx * RenderContext ,
228
227
defaultLink , content string ,
229
228
) (string , error ) {
230
- procs := commitMessageSubjectProcessors
231
- rendered , err := renderProcessString (ctx , procs , content )
232
- if err != nil {
233
- return "" , err
234
- }
235
- if defaultLink != "" {
236
- rendered = fmt .Sprintf (`<a href="%s" class="muted">%s</a>` , template .HTMLEscapeString (defaultLink ), rendered )
237
- }
238
- return rendered , nil
229
+ procs := slices .Clone (commitMessageSubjectProcessors )
230
+ procs = append (procs , func (ctx * RenderContext , node * html.Node ) {
231
+ ch := & html.Node {Parent : node , Type : html .TextNode , Data : node .Data }
232
+ node .Type = html .ElementNode
233
+ node .Data = "a"
234
+ node .DataAtom = atom .A
235
+ node .Attr = []html.Attribute {{Key : "href" , Val : defaultLink }, {Key : "class" , Val : "muted" }}
236
+ node .FirstChild , node .LastChild = ch , ch
237
+ })
238
+ return renderProcessString (ctx , procs , content )
239
239
}
240
240
241
241
// RenderIssueTitle to process title on individual issue/pull page
You can’t perform that action at this time.
0 commit comments