Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: delvh <[email protected]>
  • Loading branch information
wxiaoguang and delvh authored Apr 15, 2023
1 parent 97617ae commit 3af994b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion modules/markup/markdown/convertyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func nodeToTable(meta *yaml.Node) ast.Node {

func mappingNodeToTable(meta *yaml.Node) ast.Node {
table := east.NewTable()
var alignments []east.Alignment
var alignments := make([]east.Alignment, 0, len(meta.Content)/2)
for i := 0; i < len(meta.Content); i += 2 {
alignments = append(alignments, east.AlignNone)
}
Expand Down
1 change: 1 addition & 0 deletions modules/markup/markdown/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func newParserContext(ctx *markup.RenderContext) parser.Context {
return pc
}

// SpecializedMarkdown sets up the Gitea specific markdown extensions
func SpecializedMarkdown() goldmark.Markdown {
specMarkdownOnce.Do(func() {
specMarkdown = goldmark.New(
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/wiki.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func renderViewPage(ctx *context.Context) (*git.Repository, *git.TreeEntry) {
sb := &strings.Builder{}
err = markdown.SpecializedMarkdown().Renderer().Render(sb, nil, rctx.SidebarTocTree)
if err != nil {
log.Error("Failed to render SidebarTocTree: %v", err)
log.Error("Failed to render wiki sidebar TOC: %v", err)
} else {
ctx.Data["sidebarTocTree"] = sb.String()
}
Expand Down

0 comments on commit 3af994b

Please sign in to comment.