OpenMark is a Chrome Manifest V3 extension that renders markdown files in-browser. The content script replaces the entire page body with a three-panel layout (file explorer | rendered content + editor | settings/chat panel).
npm run build # Full build (tsc → vite → ascii-escape → pages)
npx tsc --noEmit # Type-check onlyNo test framework. Manual testing: load dist/ as unpacked extension, open a .md file.
- Content script (
src/content/): Single IIFE bundle. Entry:index.ts. Bundles mermaid, highlight.js, katex. - Background worker (
src/background/index.ts): Proxiesfile://fetches and directory listings. - Shared (
src/shared/): Types and storage helpers.
- TypeScript strict mode, no
anyexcept markdown-it plugin internals - No comments unless explaining a non-obvious workaround
- DOM manipulation via
createElement+ properties (neverinnerHTMLwith user data — XSS risk) - All state persisted via
chrome.storage.sync(settings) orchrome.storage.local(UI state)
- Never use
innerHTMLwith interpolated user content (headings, file names, etc.) - Mermaid is bundled in content.js — do NOT add it as external or inject scripts
- The ASCII-escape post-build step is mandatory for Chrome Web Store
package.jsonversion andpublic/manifest.jsonversion must always match- File explorer uses Chrome's
addRow()HTML format from directory fetch responses - Editor re-renders must set
renderFromEditor = trueto preserve cursor position - Keep
host_permissionsin manifest updated if adding new external API integrations