Skip to content

Commit

Permalink
If index generated at ".", H3 subtitle is "top"
Browse files Browse the repository at this point in the history
  • Loading branch information
nao1215 committed Nov 4, 2023
1 parent 85fce0d commit 4a2a24a
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 4a2a24a

Please sign in to comment.