Legal–Markdown-JS, Git-friendly legal docs with Markdown and helpers
Hi HN! I'm sharing legal-markdown-js, a TypeScript port of an abandoned 2011 Ruby gem that solves a surprisingly complex problem: writing legal documents that don't break when you edit them. The Problem: Legal documents have intricate numbering schemes (1.1.1, (a)(i), etc.) and cross-references. Change one section and you might need to renumber 50+ references manually. Plus there's tons of repetitive boilerplate clauses scattered across documents. Lawyers often avoid restructuring documents because it's too error-prone. The Solution: Write contracts in Markdown with tons of helper functions:…
In plain words
Legal-Markdown-JS is a TypeScript tool for writing legal documents in Markdown that automatically handles complex numbering schemes and cross-references. It lets lawyers write contracts with helper functions for auto-numbering, variables, conditional blocks, and imports, eliminating manual renumbering when sections change. The tool is designed for legal professionals who need to restructure documents without breaking internal references and boilerplate text. It revives functionality from an earlier Ruby gem.
written from the facts on this page · September 2026
From the sources
In the maker’s words, at launch
Hi HN! I'm sharing legal-markdown-js, a TypeScript port of an abandoned 2011 Ruby gem that solves a surprisingly complex problem: writing legal documents that don't break when you edit them. The Problem: Legal documents have intricate numbering schemes (1.1.1, (a)(i), etc.) and cross-references. Change one section and you might need to renumber 50+ references manually. Plus there's tons of repetitive boilerplate clauses scattered across documents. Lawyers often avoid restructuring documents because it's too error-prone. The Solution: Write contracts in Markdown with tons of helper functions: auto-numbering, variables, conditional blocks, cross-references, and imports. Example --- party1: "ACME Corp" party2: "{{client_name}}" jurisdiction: "California" --- # Software License Agreement l. This Agreement is between {{party1}} and {{party2}}. l. License Grant ll. Restrictions lll. No reverse engineering lll. See section @[License Grant] for details {{#if enterprise}} l. Enterprise Features ll. Priority support included {{/if}} @import "clauses/standard_termination.md" The l. markers become proper legal numbering, variables expand ({{client_name}}), conditional blocks show/hide content ({{#if enterprise}}), cross-references update automatically (@[License Grant]), and imports (@import) let you reuse boilerplate clauses. Why I Built This I stopped programming to build startups, became a corporate PM, and now I'm starting a fund. I wanted control over the legal documents we share with LPs and portfolio companies – tired of paying lawyers for simple template changes, but most importantly frustrated with losing version history in Word docs. Scratching this itch became my late-night learning vehicle for modern development practices. What started as "I'll just port this Ruby gem" turned into a deep dive into TypeScript, testing frameworks, and the entire modern JS ecosystem. Technical Details - Full TypeScript with strict typing - Extensive test coverage - ESM-first with CommonJS fallback - Remark/Unified integration for extensibility - CLI + programmatic API - Full processing pipeline with multiple format outputs including PDF with highlights The original Ruby gem was solid but abandoned. The JavaScript ecosystem deserved a maintained version, especially with legal tech growing rapidly. Who This Helps - Humans and legal professionals tired of Word's auto-numbering disasters - Legal tech companies building document automation - Anyone generating contracts programmatically - Developers who need to template complex documents GitHub: https://github.com/petalo/legal-markdown-js/ Playground: https://petalo.github.io/legal-markdown-js/ Original Ruby Project: https://github.com/compleatang/legal-markdown
More work this month
the category →


The app store for voice native apps that lives in your notch
Work · 28d ago · voiceos.com

The New Calendly▲211Handle all of the work before, during, and after meetings
Work · 17d ago · calendly.com
Launched alongside, July 2025
the whole month →
Trickle - Magic Canvas ▲1,064The 1st Agentic Canvas for building apps visually with AI
AI · 2025 · trickle.so
- TB
Life & fun · 2025 · trytender.app
- TY
Today marks ten years, 3653 consecutive days, of running at least one mile every day under the USRSA rules [1]. To celebrate, I built an interactive dashboard that turns a decade of GPX files into charts you can explore. Running has truly changed my life: I've made lifelong friends, explored beautiful places, and more importantly invested into my own health and fitness, which I'm starting to see the positive benefits as I get older. The stack is pretty simple: a NextJS app, with a Postgres database to keep all my running data, and all the stats are pre-computed and cached in Redis, so I…
Dev tools · 2025 · nodaysoff.run
- DA
Made this website as an exercise in vibe-coding and GCP. It was posted about a few times around the internet, on sites like Morning Brew (https://www.morningbrew.com/issues/business-buzzkill), MetaFilter (https://www.metafilter.com/209703/Draw-A-Fish), boingboing.net, etc. I think it's cute! I built a basic CNN trained against penises and swastikas, and then anything that doesn't hit the 63% confidence score gets sent to a mod queue, a vibe-coded fish-tinder…
Dev tools · 2025 · drawafish.com