Skip to content

Commit

Permalink
Fix same issue on inline TOC
Browse files Browse the repository at this point in the history
  • Loading branch information
johansatge committed Sep 25, 2023
1 parent ea90a29 commit 6e7d3fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.js
Expand Up @@ -120,7 +120,10 @@ function getMarkdownNestedListFromHeadings(headings, options) {
function getMarkdownInlineFirstLevelFromHeadings(headings, options) {
const items = headings
.filter((heading) => heading.level === 1)
.map((heading) => options.includeLinks ? `[[#${heading.heading}|${heading.display}]]` : heading.heading)
.map((heading) => {
const label = heading.display || heading.heading
return options.includeLinks ? `[[#${heading.heading}|${label}]]` : heading.heading
})
return items.length > 0 ? items.join(' | ') : null
}

Expand Down

0 comments on commit 6e7d3fa

Please sign in to comment.