Skip to content

feat: auto-detect .md URL pattern to reduce wasted requests#45

Merged
dacharyc merged 1 commit intoagent-ecosystem:mainfrom
mvvmm:feat/auto-detect-md-url-order
Apr 19, 2026
Merged

feat: auto-detect .md URL pattern to reduce wasted requests#45
dacharyc merged 1 commit intoagent-ecosystem:mainfrom
mvvmm:feat/auto-detect-md-url-order

Conversation

@mvvmm
Copy link
Copy Markdown
Contributor

@mvvmm mvvmm commented Apr 19, 2026

markdown-url-support tries two .md URL candidates per page: page.md then page/index.md. Sites that use the index.md convention pay a wasted 404 on every page because the wrong form is tried first.

This PR auto-detects the site's pattern after the first batch. Once 80%+ of successful results use the same form, subsequent batches try that form first.

Impact: At default settings (200ms delay, 3 concurrent), reduces markdown-url-support check runtime by ~60% for sites that use page/index.md. Sites using page.md are unaffected — the default order is already optimal for them.

How it works:

  1. First batch uses the default order (page.md first)
  2. After each batch, detectPreferredMdForm() tallies which form succeeded
  3. Once a clear winner emerges (≥80%), orderCandidates() puts it first for remaining batches

After the first batch of markdown-url-support requests, detect whether
the site uses page.md or page/index.md based on which form succeeded.
Once a clear pattern emerges (80%+), subsequent batches try the winning
form first, saving one 404 per page.

At default settings (200ms delay, 3 concurrent), this reduces check
runtime by ~60% for sites that consistently use one form.
@mvvmm mvvmm force-pushed the feat/auto-detect-md-url-order branch from 2fd7894 to 841a7e3 Compare April 19, 2026 07:17
Copy link
Copy Markdown
Member

@dacharyc dacharyc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! It's a nice improvement; I appreciate the PR. 🎉

@dacharyc dacharyc merged commit 62cc3d8 into agent-ecosystem:main Apr 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants