Skip to content

Commit

Permalink
Merge pull request #9 from go-spectest/fix-h2
Browse files Browse the repository at this point in the history
If index generated at ".", H3 subtitle is "top"
  • Loading branch information
nao1215 authored Nov 4, 2023
2 parents 85fce0d + 4a2a24a commit b7e8092
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion index.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,13 @@ func (i *Index) write() (err error) {
if len(d.files) == 0 {
continue
}
markdown.H3(filepath.Base(d.path))

subTitle := filepath.Base(d.path)
if subTitle == "." {
subTitle = "top"
}
markdown.H3(subTitle)

for _, f := range d.files {
if h1 := firstH1orH2(f); h1 != "" {
markdown.BulletList(Link(h1, strings.Replace(f, i.targetDir+string(filepath.Separator), "", 1)))
Expand Down

0 comments on commit b7e8092

Please sign in to comment.