diff --git a/documize/section/github/github.go b/documize/section/github/github.go
index befce79e..0714f3c9 100644
--- a/documize/section/github/github.go
+++ b/documize/section/github/github.go
@@ -308,18 +308,18 @@ func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]gi
ret = append(ret, githubIssueActivity{
Name: n,
Event: "TITLE",
- Message: *issue.Title, // TODO move?
+ Message: template.HTML(*issue.Title),
Date: issue.UpdatedAt.Format("January 2 2006, 15:04"),
Avatar: a,
- URL: *issue.HTMLURL,
+ URL: template.URL(*issue.HTMLURL),
})
ret = append(ret, githubIssueActivity{
Name: n,
Event: "DESCRIPTION",
- Message: *issue.Body,
+ Message: template.HTML(*issue.Body),
Date: issue.UpdatedAt.Format("January 2 2006, 15:04"),
Avatar: a,
- URL: *issue.HTMLURL,
+ URL: template.URL(*issue.HTMLURL),
})
} else {
return ret, err
@@ -372,10 +372,10 @@ func (*Provider) getIssueNum(client *gogithub.Client, config githubConfig) ([]gi
ret = append(ret, githubIssueActivity{
Name: n,
Event: *v.Event,
- Message: m,
+ Message: template.HTML(m),
Date: v.CreatedAt.Format("January 2 2006, 15:04"),
Avatar: a,
- URL: u,
+ URL: template.URL(u),
})
}
}
@@ -421,15 +421,15 @@ func (*Provider) getIssues(client *gogithub.Client, config githubConfig) ([]gith
}
l := ""
for _, ll := range v.Labels {
- l += `` + *ll.Name + ` `
+ l += `` + *ll.Name + ` `
}
ret = append(ret, githubIssue{
Name: n,
Message: *v.Title,
Date: v.UpdatedAt.Format("January 2 2006, 15:04"),
Avatar: a,
- URL: *v.HTMLURL,
- Labels: l,
+ URL: template.URL(*v.HTMLURL),
+ Labels: template.HTML(l),
})
}
@@ -507,7 +507,7 @@ func (*Provider) getCommits(client *gogithub.Client, config githubConfig) ([]git
Message: m,
Date: d,
Avatar: a,
- URL: u,
+ URL: template.URL(u),
})
}
@@ -610,11 +610,11 @@ func (p *Provider) Render(config, data string) string {
client := p.githubClient(c)
for k, v := range raw {
if v.Event == "commented" {
- output, _, err := client.Markdown(v.Message, opt)
+ output, _, err := client.Markdown(string(v.Message), opt)
if err != nil {
log.Error("convert commented text to markdown", err)
} else {
- raw[k].Message = output
+ raw[k].Message = template.HTML(output)
}
}
}
diff --git a/documize/section/github/model.go b/documize/section/github/model.go
index 16e2d42c..21b3f7bf 100644
--- a/documize/section/github/model.go
+++ b/documize/section/github/model.go
@@ -12,6 +12,7 @@
package github
import (
+ "html/template"
"strings"
"time"
@@ -164,29 +165,29 @@ type githubBranchCommits struct {
}
type githubCommit struct {
- Date string `json:"date"`
- Message string `json:"message"`
- URL string `json:"url"`
- Name string `json:"name"`
- Avatar string `json:"avatar"`
+ Date string `json:"date"`
+ Message string `json:"message"`
+ URL template.URL `json:"url"`
+ Name string `json:"name"`
+ Avatar string `json:"avatar"`
}
type githubIssue struct {
- Date string `json:"date"`
- Message string `json:"message"`
- URL string `json:"url"`
- Name string `json:"name"`
- Avatar string `json:"avatar"`
- Labels string `json:"labels"`
+ Date string `json:"date"`
+ Message string `json:"message"`
+ URL template.URL `json:"url"`
+ Name string `json:"name"`
+ Avatar string `json:"avatar"`
+ Labels template.HTML `json:"labels"`
}
type githubIssueActivity struct {
- Date string `json:"date"`
- Event string `json:"event"`
- Message string `json:"message"`
- URL string `json:"url"`
- Name string `json:"name"`
- Avatar string `json:"avatar"`
+ Date string `json:"date"`
+ Event string `json:"event"`
+ Message template.HTML `json:"message"`
+ URL template.URL `json:"url"`
+ Name string `json:"name"`
+ Avatar string `json:"avatar"`
}
type githubConfig struct {