Skip to content

CarveA markup language for documents

Syntax for headings, tables, captions, references, math, and optional extensions.

Carve logo

Syntax

carve
# Release notes

This has /italic/, *bold*, _underline_, ~strikethrough~, and =highlight=.

- [x] Publish the release
- [ ] Update the package

|= Package |= Version |
| carve-js | 0.1 |
^ Published packages

::: note
Containers can represent admonitions and application-defined blocks.
:::
ConstructSyntax
Heading# Heading
Link[text](https://example.com)
Image![alt](image.jpg)
Cross-reference</#heading-id>
Footnote[^note]
Inline math$`x + y`
Attributes{#id .class key=value}
Extension:name[content]

The cheat sheet lists every construct. Examples show Carve source beside its HTML output.

Why Carve

  • Cross-references and numbered captions keep labels and link text in sync.
  • Tables support captions, alignment, rowspan, colspan, and multiline cells without HTML.
  • JavaScript, PHP, and Rust are tested with the same Carve inputs and expected HTML outputs.
  • A document can be rendered as HTML, Markdown, plain text, or ANSI terminal text. Rendering methods can warn when an output format omits content.
  • If an application does not recognize an extension, its content remains in an ordinary span or div.
  • Bare HTML is literal text. Explicit =html passthrough can be disabled for untrusted input.

Install

bash
npm install @markup-carve/carve
composer require markup-carve/carve-php
cargo install carve-lang
ts
import { carveToHtml } from '@markup-carve/carve'

const html = carveToHtml('/italic/ and *bold*')

See Get Started for PHP, the Rust CLI, WebAssembly, and language bindings.

Scope

Carve is a separate language, not a Markdown extension. Use a Carve parser for .crv files. The Markdown migration guide lists syntax differences and Format conversion describes which content can be preserved.

Core syntax is always available. Some features, including citations, automatic URL linking, and diagrams, must be enabled separately. The optional features table lists their availability.

Influences

  • Markdown - ubiquitous baseline; paragraph interruption without a blank line
  • Djot (John MacFarlane) - rigorous parsing, attributes, foundation
  • Org-mode - /italic/ syntax, TODO states
  • Creole - |= table headers
  • AsciiDoc - admonitions, document structure
  • CriticMarkup - editorial annotations

Reference

Carve 0.1 is specified. Minor releases may change the grammar before 1.0; see Versioning.

Released under the MIT License.