Skip to content

Commit a0c54a2

Browse files
committed
feat: support hide_title in frontmatter to skip the default h1 created
1 parent 7bd1b5b commit a0c54a2

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/generators/jsx-ast/utils/buildContent.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ export const createHeadingElement = (content, changeElement) => {
136136

137137
let headingContent = extractHeadingContent(content);
138138

139+
if (content.data.hideTitle) {
140+
return { type: 'text', value: '' };
141+
}
142+
139143
// Build heading with anchor link
140144
const headingWrapper = createElement('div', [
141145
createElement(

src/generators/metadata/utils/parse.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,11 @@ export const parseApiDoc = ({ path, tree, mdx = false }, typeMap) => {
138138
metadata.heading.data.type = metadata.type;
139139
}
140140

141+
// To hide the default heading created when there is no heading in the file.
142+
if (metadata.hide_title) {
143+
metadata.heading.data.hideTitle = true;
144+
}
145+
141146
// Process Unix manual references
142147
visit(subTree, UNIST.isTextWithUnixManual, (node, _, parent) =>
143148
visitTextWithUnixManualNode(node, parent)

0 commit comments

Comments
 (0)