fix copy md (#12790)

This commit is contained in:
Edwin Lim
2025-09-15 12:00:28 -04:00
committed by GitHub
parent a8e2aeacd1
commit fc40ced4c0
2 changed files with 9 additions and 2 deletions

View File

@@ -252,10 +252,15 @@ export const onCreateNode: GatsbyNode['onCreateNode'] = async ({
const contentWithoutFrontmatter = stripFrontmatter(node.rawBody)
const contentWithSnippets = resolveSnippets(contentWithoutFrontmatter, node.fileAbsolutePath)
// Prepend title as H1 if it exists
const title = node.frontmatter?.title
const contentWithSnippetsAndTitle = title ? `# ${title}\n\n${contentWithSnippets}` : contentWithSnippets
createNodeField({
node,
name: `contentWithSnippets`,
value: contentWithSnippets,
value: contentWithSnippetsAndTitle,
})
}

View File

@@ -340,7 +340,7 @@ export default function Handbook({
hideRightSidebar,
contentMaxWidthClass,
},
fields: { slug, contributors, appConfig, templateConfigs, commits },
fields: { slug, contributors, appConfig, templateConfigs, commits, contentWithSnippets },
excerpt,
} = post
@@ -401,6 +401,7 @@ export default function Handbook({
showSurvey
hideRightSidebar={hideRightSidebar}
contentMaxWidthClass={contentMaxWidthClass}
markdownContent={contentWithSnippets}
/>
</>
)
@@ -435,6 +436,7 @@ export const query = graphql`
excerpt(pruneLength: 150)
fields {
slug
contentWithSnippets
commits {
author {
avatar_url