GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - docspec/docspec: Home for the Rust implementation for DocSpec

BranchesTags
Open more actions menu

Latest commit

 

History

524 Commits
524 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
crates
crates
 
 
tests
tests
 
 
.dockerignore
.dockerignore
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
AGENTS.md
AGENTS.md
 
 
ARCHITECTURE.md
ARCHITECTURE.md
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CODING_STANDARDS.md
CODING_STANDARDS.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
MANIFESTO.md
MANIFESTO.md
 
 
README.md
README.md
 
 
RELEASING.md
RELEASING.md
 
 
SECURITY.md
SECURITY.md
 
 
TESTING.md
TESTING.md
 
 
TRIAGE.md
TRIAGE.md
 
 
deny.toml
deny.toml
 
 
justfile
justfile
 
 
kodus-config.yml
kodus-config.yml
 
 
release-plz.toml
release-plz.toml
 
 
renovate.json
renovate.json
 
 

Repository files navigation

DocSpec

Streaming document conversion that keeps as little of the document in memory as the format allows.

Documents, as they flow. DocSpec reads a document as a stream of typed events and writes it back out in another format — one event at a time, in constant memory for DOCX and HTML read from a path apart from the cases under Not bounded; Markdown is bounded by its input size. Streaming is the whole point; the Manifesto explains why.

Funded by NLnet through the NGI0 Commons Fund, and the Netherlands' Ministry of the Interior and Kingdom Relations.

NLnet    NGI0 Commons Fund    Ministerie van Binnenlandse Zaken en Koninkrijksrelaties

Used by DINUM — La Suite Numérique.

Gouvernement    La Suite Numérique

Getting started

Two ways in, depending on what you need.

Convert a file — the CLI

Install with Cargo:

cargo install docspec-cli

Convert a document — the formats are inferred from the input and output file extensions:

docspec convert report.docx --output report.md

Or pipe through stdin and name the formats explicitly:

echo '# Hello' | docspec convert --from markdown --to blocknote

Run the API — Docker or the CLI

The ghcr.io/docspec/api image is the conversion server, ready to run with no Rust toolchain:

docker run --rm -p 3000:3000 ghcr.io/docspec/api

Installed the CLI instead? It ships the same server:

docspec http            # serves on 127.0.0.1:3000

Either way, send it a document — the Content-Type picks the reader, the Accept header picks the writer (BlockNote JSON by default):

curl -X POST http://localhost:3000/conversion \
     -H 'Content-Type: text/markdown' \
     -d '# Hello'

GET /conversion lists the media types the running server reads and writes, GET /openapi.json describes the conversion and health endpoints in OpenAPI 3.1, GET /health is the liveness check; docspec-http has the full endpoint, header, and format reference.

What it reads and writes

Readers and writers are fully decoupled: any reader can feed any writer, because the event stream is the only contract between them. That decoupling is mechanical — every pairing runs, but a conversion is only as faithful as its least-capable endpoint.

Formats carry one of two statuses:

  • Supported — intended for production use within its documented mapping. Common document structure is covered, and the known limitations are part of the maintained contract. This does not mean lossless interchange.
  • Experimental — coverage is deliberately incomplete. Common structures may be silently omitted from the output. Don't rely on it where fidelity matters.
Direction Format Status Coverage today
Reads DOCX Supported Headings, tables, lists, hyperlinks, images, run styles, colors
Reads Markdown Supported CommonMark + GFM tables and strikethrough1
Reads HTML Experimental <p> elements and their text only — every other tag is dropped
Writes BlockNote JSON Supported Headings, lists, tables, links, images, styles, quotes, code
Writes Pandoc native Experimental Paragraphs, headings, styles, code; no lists, tables, links, images
Writes Markdown Experimental Paragraphs and headings, text only
Writes HTML Experimental Paragraphs and text only
Writes oxa.dev JSON Experimental Paragraphs and text only

This table is the canonical statement of format maturity. Each crate's README remains the authoritative reference for exactly which events it handles and drops.

Why DocSpec?

Most document converters load the whole file into memory, build a tree, and hope it fits. That works until someone uploads a 200 MB report — or until you need the same converter to run inside a browser tab. DocSpec exists to turn real-world documents into what modern web editors actually consume — BlockNote JSON, oxa.dev — event by event, holding as little of the document as each parser allows.

Streaming event by event is the one decision everything else follows from:

  • It runs where your editor runs. The same Rust compiles to a native server, a WebAssembly module in the browser, or an embedded target — one codebase, every surface, no separate front-end and back-end converters drifting apart.
  • Its memory stays flat. For DOCX and HTML read from a path, a 1 KB note and a 500 MB document cost about the same to convert, apart from the cases under Not bounded. Markdown is bounded by its input size.
  • It stays honest. On corrupt input it stops and says so — no half-converted output quietly reaching your database.

DocSpec is the Rust successor to NLdoc, rebuilt for public-sector digital sovereignty: funded by NLnet and the Dutch Ministry of the Interior, and used in production by La Suite to import documents into its collaborative editor. The Manifesto is the long version of why.

The crates

DocSpec is a Cargo workspace. Most users want the docspec facade; reach for the individual crates when you want the smallest possible dependency footprint.

Core

  • docspec — convenience facade; readers, writers, and core types behind feature flags
  • docspec-core — the event model, the EventSource/EventSink traits, and the streaming pipeline

Readers

  • docspec-docx-reader — DOCX
  • docspec-html-reader — HTML
  • docspec-markdown-reader — Markdown (CommonMark + GFM)
  • docspec-odt-reader — ODT (placeholder: emits an empty document)

Writers

  • docspec-html-writer — HTML
  • docspec-markdown-writer — Markdown
  • docspec-blocknote-writer — BlockNote JSON
  • docspec-oxa-writer — oxa.dev JSON
  • docspec-pandoc-native-writer — Pandoc native

Primitives & tooling

  • docspec-json — streaming JSON emission primitives for custom writers
  • docspec-cli — the docspec command-line binary
  • docspec-http — the HTTP conversion server
  • docspec-wasm — WebAssembly bindings

Documentation

  • Manifesto — philosophy and values
  • Architecture — the streaming pipeline, reader/writer contracts, and the event model
  • Coding Standards — the code style and the review bar
  • Contributing — workflow, commits, PRs, semver
  • Bug Triage & Reporting — filing actionable bug reports and how we triage them
  • Testing — the coverage floor and test philosophy
  • Security — error handling by context, resource limits
  • Agents — guidance for AI agents working in this repo

What we stand for

  • Memory conscious — constant memory for DOCX and HTML read from a path apart from the cases under Not bounded, Markdown bounded by input size; every allocation earns its keep.
  • Streaming first — events flow one at a time; for DOCX and HTML read from a path, nothing accumulates apart from the cases under Not bounded.
  • Fail fast — on corruption we stop and say so: no partial output, no silent truncation.
  • No unsafe — the workspace forbids unsafe entirely.
  • Proven — a 98% coverage floor on new and changed executable Rust lines in covered crates; no unwrap or expect in source.

Status

DocSpec is under active development. The architecture is stable and the event model is defined; readers and writers land incrementally. We keep the public API honest about what is supported today versus what a crate silently drops.

Contributing

DocSpec is built in the open, and contributions are welcome — a new reader or writer, a bug fix, a sharper doc, a failing test that pins down an edge case. We hold a high bar (no unsafe, no unwrap in source, a 98% coverage floor on new and changed executable Rust lines in covered crates), but the bar is written down, not hidden. Start with CONTRIBUTING.md for the full workflow.

A few good entry points:

  • Found a bug? Bug Triage & Reporting shows what makes a report we can fix today. Security issues go privately — never a public issue.
  • Have an idea, or a design to talk through? Open an issue and tag it as a proposal.
  • Ready to write code? Building and Running Locally gets you set up in a few commands.

Every contribution is attributed in the git history, and we treat review as collaboration, not gatekeeping.

License

MIT.

Thanks

This work grew out of the mentoring and support of @virgile-dev.

Footnotes

  1. The Markdown reader holds the whole source in memory while it parses (pulldown-cmark is borrow-based), so peak memory is about 3× the input size. Events still flow one at a time. DOCX and HTML read from a path stream in constant memory apart from the cases under Not bounded. ↩

About

Home for the Rust implementation for DocSpec

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

17 stars

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.