@redpanda-data/docs-extensions-and-macros 4.15.5 → 4.15.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -490,17 +490,27 @@ module.exports.register = function () {
490
490
  logger.debug(`Generated frontmatter for ${page.src?.path}`)
491
491
  }
492
492
 
493
- // Prepend frontmatter first, then source reference and AI-friendly note
493
+ // Extract H1 heading if present (only at document start)
494
+ const h1Match = markdown.match(/^(#\s+.+?)(\n|$)/)
495
+ let h1Heading = ''
496
+ let restOfMarkdown = markdown
497
+
498
+ if (h1Match) {
499
+ h1Heading = h1Match[0]
500
+ restOfMarkdown = markdown.substring(h1Match[0].length).trimStart()
501
+ }
502
+
503
+ // Add frontmatter AFTER H1 heading, then source reference and AI-friendly note
494
504
  if (canonicalUrl) {
495
505
  const componentName = page.src?.component || '';
496
506
  const urlHint = componentName
497
507
  ? `<!-- Note for AI: This is a Markdown export. For aggregated content, see /llms.txt (curated overview), /${componentName}-full.txt (this component only), or /llms-full.txt (complete documentation). -->`
498
508
  : `<!-- Note for AI: This is a Markdown export. For aggregated content, see /llms.txt (curated overview) or /llms-full.txt (complete documentation). -->`;
499
509
 
500
- markdown = `${frontmatter}<!-- Source: ${canonicalUrl} -->\n${urlHint}\n\n${markdown}`
510
+ markdown = `${h1Heading}\n${frontmatter}<!-- Source: ${canonicalUrl} -->\n${urlHint}\n\n${restOfMarkdown}`
501
511
  } else if (frontmatter) {
502
- // If no canonical URL but we have frontmatter, still add it
503
- markdown = `${frontmatter}${markdown}`
512
+ // If no canonical URL but we have frontmatter, still add it after H1
513
+ markdown = `${h1Heading}\n${frontmatter}${restOfMarkdown}`
504
514
  }
505
515
 
506
516
  // Clean up unnecessary whitespace
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "4.15.5",
3
+ "version": "4.15.6",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",