Skip to content

Commit ae5ccd0

Browse files
committed
fix: fallback when no heading
1 parent 6b7d035 commit ae5ccd0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/generators/legacy-html/index.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ export default {
130130
// Retrieves when this node was added to the API docs
131131
const addedAt = head.updates.find(({ type }) => type === 'introduced_in');
132132

133+
// In case there's no Heading, we make a little capitalization of the filename
134+
const apiAsHeading = head.api.charAt(0).toUpperCase() + head.api.slice(1);
135+
133136
const generatedTemplate = {
134137
api: head.api,
135138
added: addedAt ? addedAt.version[0] : '',
136-
section: head.heading.data.name,
139+
section: head.heading.data.name || apiAsHeading,
137140
version: `v${version.toString()}`,
138141
toc: String(parsedToC),
139142
nav: String(activeSideNav),

0 commit comments

Comments
 (0)