Daniel Marques

markschema - Markdown in, typed JSON out — no regex, no AST glue code

by
mdshape is a schema-first library that turns any Markdown file into typed JSON with a single function call. Instead of writing regex, chaining remark plugins, or walking ASTs manually, you define a schema — headings, sections, fields, tables, code blocks — and mdshape parses and validates everything for you. Errors come back with line numbers, paths, and codes. 27 typed builders for tables, Mermaid diagrams, LaTeX math, images, links, and more. Full TypeScript inference from schema to json.

Add a comment

Replies

Best
Daniel Marques
Hey everyone! I'm the maker of mdshape. I kept running into the same problem: Markdown is everywhere — docs, runbooks, AI prompts, PDF exports — but extracting structured data from it always meant regex spaghetti or fragile AST walkers. So I built mdshape: you define a schema describing the Markdown structure you expect, call .safeParse(markdown), and get typed JSON back. If something's wrong, you get diagnostics with line numbers — not silent failures. A few real use cases we're seeing: RAG pipelines — parse .md files into clean, typed chunks before embedding PDF-to-MD validation — verify that converted documents actually have the right structure Structured AI Skills — author agent prompts as Markdown and validate them at build time It ships with 27 builders for everything from headings and tables to Mermaid diagrams and LaTeX math blocks. Would love your feedback — try the playground or check the docs. Happy to answer any questions here!