Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: skip headings inside fenced code blocks in heading extraction

Sushmithamallesh7bcdf8a8fbd6
diff --git a/docs/scripts/validate-links.ts b/docs/scripts/validate-links.ts
index 4482c3aa5..e1ccf4d23 100644
--- a/docs/scripts/validate-links.ts
+++ b/docs/scripts/validate-links.ts
@@ -31,7 +31,13 @@ type PageOf = ReturnType<AnySource['getPages']>[number];
function extractHeadingsFromContent(content: string): string[] {
const slugger = new GithubSlugger();
const headings: string[] = [];
+ let inCodeBlock = false;
for (const line of content.split('\n')) {
+ if (line.startsWith('```')) {
+ inCodeBlock = !inCodeBlock;
+ continue;
+ }
+ if (inCodeBlock) continue;
const match = line.match(/^#{1,6}\s+(.+)$/);
if (match) {
headings.push(slugger.slug(match[1]));