Skip to content

Commit

Permalink
fix: missing h1 heading (fixes #124)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed May 15, 2024
1 parent 009cdc5 commit 9e35612
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/website/src/app/workshop/workshop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ export async function loadWorkshop(repoPath: string, options?: LoaderOptions): P
const sections = fileContents.markdown.split(sectionSeparator).map((markdown, index) => {
const headings = getHeadings(markdown);
const title = fileContents.meta.sections_title?.[index] ?? headings[0]?.text ?? '';

if (headings.length && headings[0].level !== 1) {
// If we're missing the top-level heading, then add one using the title
markdown = `<h1 class="visually-hidden">${fileContents.meta.title}</h1>\n\n${markdown}`;
}

return { title, headings, markdown };
});
return {
Expand Down

0 comments on commit 9e35612

Please sign in to comment.