Skip to content

Commit

Permalink
feat(toc): open table of contents links in new tab
Browse files Browse the repository at this point in the history
Add target="_blank" attribute to table of contents links to open them in a new tab when clicked.
  • Loading branch information
duocnv-firegroup committed Sep 9, 2024
1 parent e0f40c3 commit 7108fa2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func generateTOCHTML(navPoints []NavPoint, level int) string {
html.WriteString("<ul>")

for _, np := range navPoints {
html.WriteString(fmt.Sprintf("<li><a href=\"%s\">%s</a>", np.Content.Src, np.NavLabel.Text))
html.WriteString(fmt.Sprintf("<li><a target=\"_blank\" href=\"%s\">%s</a>", np.Content.Src, np.NavLabel.Text))
if len(np.NavPoints) > 0 {
html.WriteString(generateTOCHTML(np.NavPoints, level+1))
}
Expand Down

0 comments on commit 7108fa2

Please sign in to comment.