Skip to main content

Markdown Viewer

Purpose: Self-hosted markdown editor and preview utility for Pacing Agency, used for fast draft creation, export workflows, and shareable review links.

Where it runs: Cloudflare Pages (production + preview deployments), plus local static runtime for development.

Last verified: 2026-03-13


Access​

  • Owner type: Internal (with optional client-facing usage via shared links)
  • Account owner: Pacing Agency
  • Technical owner: Pacing Engineering / Delivery
  • Category: SELF_HOSTING
  • Account type: INTERNAL, CLIENT_ACCESS
  • Monthly cost: 0.00 GBP (free Cloudflare Pages tier at current usage)
  • Primary URL: viewer.pacing.agency
  • Preview URLs: Cloudflare Pages *.pages.dev branch previews
  • Environment mapping:
    • Production: Cloudflare Pages deploy from main
    • Staging/Preview: Branch-based preview deploys in Pages
    • Development: Local static runtime (no backend service required)

API Access​

The viewer itself is fully client-side and does not require a runtime backend API.

  • Runtime auth: None for end users (public static app)
  • Credential storage: N/A for app runtime; deploy credentials remain in Cloudflare dashboard and maintainer auth sessions
  • Secret handling: No runtime secrets should be embedded in frontend code
  • Rate limits: Cloudflare Pages platform limits apply to hosted delivery

The viewer has a dedicated MCP server for share-link workflows in Cursor:

  • MCP server identifier: project-0-pacingmd-viewer-share
  • Server name: viewer-share
  • Tool 1: generate_viewer_share_link
    • Generates https://viewer.pacing.agency URLs from markdown content or file paths
    • Supports view mode (editor, split, preview)
    • Supports copyToClipboard, save, and saved-link metadata (name, summary)
    • Supports optional custom origin, pathname, URL length warning threshold, and registry path
  • Tool 2: list_viewer_share_links
    • Lists previously saved links from local JSONL registry
    • Supports optional limit and custom registryPath

Current use​

  • Drafting and reviewing markdown for internal docs and client handover assets
  • Creating fast collaborative review links without requiring accounts
  • Exporting markdown outputs into MD/HTML/PDF formats
  • Sharing pre-set viewer states (content + view mode) through encoded URL hashes
  • Supporting Cursor-based documentation workflows via MCP share-link generation
  • Markdown payloads are compressed and encoded into URL hash parameters
  • View mode can be pre-set in links (editor, split, preview)
  • Links are client-side decoded by the viewer at runtime
  • Backward compatibility for older share links should be preserved when format changes

Dependencies​

Infrastructure​

  • Hosting: Cloudflare Pages (free static hosting tier, branch previews, custom domain support)
  • Custom domain: viewer.pacing.agency
  • Source model: Git-connected deploys from repo branch (main) or optional manual deploy via Wrangler

Frontend libraries​

  • marked (markdown parsing)
  • DOMPurify (sanitisation)
  • highlight.js (syntax highlighting)
  • MathJax (math rendering)
  • Mermaid (diagram rendering)
  • pako (share payload compression)
  • Export helpers for file downloads and PDF generation

Failure impact​

  • Documentation draft/review throughput drops
  • Share-link collaboration flow becomes unavailable
  • Export workflows for quick handovers slow down

Integrations and automations​

Cursor integration​

  • Cursor uses the viewer-share MCP server for generating and managing viewer links directly in AI workflows
  • Share links are used for rapid review loops where content needs to be previewed in a browser-ready format
  • This creates a practical bridge between Cursor authoring and browser-based markdown validation

Deployment workflows​

  • Recommended: Git-connected Cloudflare Pages deploys on push/merge
  • Alternative: Manual deploys with Wrangler for quick publish workflows
  • Desktop variant: Optional Neutralino-based desktop build in desktop-app/ (offline workflow option)

Operations​

Change and deploy workflow​

  1. Implement changes in feature branch.
  2. Validate locally (rendering, share links, export, mobile layout).
  3. Open PR and review.
  4. Merge to main.
  5. Confirm Cloudflare Pages production deployment is healthy.

Verification checklist​

  • Load viewer.pacing.agency and confirm editor + preview render
  • Validate markdown import and export (MD/HTML/PDF)
  • Generate and open share link; confirm content and view mode roundtrip
  • Validate Mermaid and Math rendering on representative sample content
  • Confirm mobile tab/menu interactions still work as expected

Rollback​

  • Revert to previous known-good commit and redeploy via Cloudflare Pages
  • Use Pages deployment history to restore prior successful version if required

Security and compliance​

  • App is client-side; no server-side processing of user-authored markdown content
  • Avoid persisting sensitive client content in long-lived local storage unless required
  • Never commit deploy credentials or API tokens
  • Keep sanitisation and rendering library updates reviewed for security regressions

Resources​


TODO​

  • Confirm and document exact Cloudflare Pages project ID for viewer.pacing.agency
  • Confirm access policy intent (fully public vs access-gated) and document final policy
  • Add a saved-link registry location standard for team machines using list_viewer_share_links
  • Add release smoke-test checklist into standard deploy process/PR template
  • Document any required retention policy for locally saved share-link registries