Overview
Allternit integrates anydoc (MIT,@firecrawl/anydoc pinned at 0.1.6) — Firecrawl’s Rust document-to-Markdown converter with prebuilt Node bindings and zero external converter dependencies. It powers the “Open as Markdown” capability across the platform: any supported document becomes clean, LLM-ready GFM Markdown.
The converter lives in the office engine (services/office-engine) as POST /markdown, proxied by the gateway at /api/office/markdown and /api/v1/office/engines/markdown. The original file is never modified; conversion is read-only.
Supported formats
Known limits (accepted by design): no OCR (scanned PDFs are rejected as unsupported), no HTML or image input, encrypted files are rejected, and decompressed input is capped at 512 MiB.
API
x-office-filename header — the extension drives format detection (with content-based detection as fallback).
markdown, detected format, and a title (first heading when present). Errors are mapped to stable codes:
URL → Markdown
anydoc itself is documents-only, so the office engine also exposesPOST /markdown-url for web pages. It fetches the page server-side with SSRF guards (http/https only; private, loopback, and link-local hosts blocked; ≤5 redirects; 15s timeout; ~10 MiB body cap), extracts the main content with @mozilla/readability, and converts it to GFM with turndown. A URL that serves a document content-type (PDF, OOXML, …) is passed through the anydoc byte path — one endpoint handles anything.
/markdown shape with format: 'html' (or the detected document format), sourceUrl (after redirects), title, and markdown. Error mapping: 400 for invalid/blocked URLs (invalidUrl / blockedUrl), 415 for unsupported content-types, 422 for fetch/parse failures. The Markdown Preview view exposes this as the Open URL as Markdown action on the office launcher and as a URL input in the preview’s empty state.
Per-surface behavior
- Web platform — formats with no native editor (legacy Office, ODF,
.rtf,.epub,.csv) open in the Markdown Preview view from the office launcher. Editor-owned formats (.docx.xlsx.pptx.pdf) still open in their editors. The preview offers Copy, Download.md, and Save as artifact (the markdown persists as amarkdown-preview/markdownsection, so agents and mobile clients see it through the existing artifact channel). - Desktop — file-association opens of anydoc-only formats land in a Markdown Preview window; in the shell they open as a preview view.
- Office add-in — the task pane’s connected-document panel has a View as Markdown action: the current document’s bytes (
Document.getFileAsync) are converted via the v1 endpoint and shown in a read-only panel with an Open in platform link. - Mobile (iOS) — no dedicated UI in v1: converted documents saved as artifacts already render in
OfficeDocumentViewvia plaintext sections.
Source
- Engine endpoint:
services/office-engine/src/markdown.ts(+POST /markdowninsrc/index.ts) - URL → Markdown:
services/office-engine/src/markdown-url.ts(+POST /markdown-urlinsrc/index.ts) - Gateway proxy:
cmd/allternit-api/src/office_engine_routes.rs - Web view:
surfaces/ai.allternit.com/src/views/office/MarkdownPreviewView.tsx - Desktop routing:
surfaces/allternit-desktop/src/main/office-programs.ts - Add-in plumbing:
surfaces/allternit-extensions/allternit-office-addin/src/lib/markdown-conversion.ts