Skip to content

ENG-9274: .md endpoints for all docs pages#1806

Open
carlosabadia wants to merge 4 commits intomainfrom
carlos/doc-endpoints
Open

ENG-9274: .md endpoints for all docs pages#1806
carlosabadia wants to merge 4 commits intomainfrom
carlos/doc-endpoints

Conversation

@carlosabadia
Copy link
Copy Markdown
Collaborator

No description provided.

@linear
Copy link
Copy Markdown

linear bot commented Apr 2, 2026

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 2, 2026

Greptile Summary

This PR introduces static .md endpoints for all docs pages by generating raw Markdown files under .web/public/<route>.md at build time, making each docs page's source content accessible via a predictable URL (e.g. /docs/getting-started/introduction.md). The implementation consists of a new pcweb/markdown_api.py module with a generate_markdown_files() helper, a doc_markdown_sources registry in pcweb/pages/docs/__init__.py, and a call-site in pcweb/pcweb.py.

Key findings:

  • Internal docs included in public .md filesdoc_markdown_sources is populated from the raw flexdown_docs list without the -style.md/-ll.md exclusion filter that resolve_doc_route applies. Files with these suffixes are explicitly excluded from the live docs site but will still be written to .web/public/ and served as .md endpoints.
  • Whitelist filtering not applied — Routes excluded by _check_whitelisted_path (e.g. in partial/feature-flagged builds) are still included in doc_markdown_sources, potentially generating .md files for pages that shouldn't be visible.
  • Hardcoded .web/public pathPUBLIC_DIR is a bare string literal relative path rather than a named constant, and unlike source-path resolution it is not anchored to Path.cwd().
  • The call ordering in pcweb.py (after outblocks processing, before app creation) is correct.

Confidence Score: 4/5

  • Mostly safe, but internal -style.md/-ll.md docs will be publicly reachable as .md endpoints until the missing filter is added.
  • One P1 finding: the population of doc_markdown_sources skips the exclusion filter that resolve_doc_route applies, meaning internal auxiliary docs are included in the public .md API. The remaining findings are P2 (whitelist alignment, hardcoded path constant). The integration point in pcweb.py is correct.
  • pcweb/pages/docs/init.py — the doc_markdown_sources population loop needs the same -style.md/-ll.md exclusion filter used by resolve_doc_route.

Important Files Changed

Filename Overview
pcweb/markdown_api.py New module that copies each doc's raw markdown source into .web/public/<route>.md; logic is straightforward but the target directory path is hardcoded and relative rather than using a named constant.
pcweb/pages/docs/init.py Adds doc_markdown_sources dict and populates it from flexdown_docs / docgen_docs without applying the -style.md/-ll.md exclusion or whitelist filtering that the existing page-registration code uses, potentially exposing internal docs as public .md endpoints.
pcweb/pcweb.py Calls generate_markdown_files() at module load time, after outblocks are processed and before the Reflex app is created — wiring is clean and ordering is correct.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[flexdown_docs list] -->|no -style.md / -ll.md filter ⚠️| B[doc_markdown_sources dict]
    C[docgen_docs dict] -->|no -style.md / -ll.md filter ⚠️| B
    D[doc_path_mapping] -->|virtual → actual path| B
    B --> E[generate_markdown_files]
    E -->|resolve absolute path| F{file exists?}
    F -- No --> G[skip silently]
    F -- Yes --> H[write to .web/public/route.md]
    I[pcweb.py module load] -->|calls after outblocks| E
    J[resolve_doc_route] -->|applies -style.md filter + whitelist| K[actual page routes]
    K -->|served as HTML pages| L[Live docs site]
    H -->|served as static files| M[.md endpoints]
Loading

Reviews (1): Last reviewed commit: "init" | Re-trigger Greptile

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.

1 participant