Search by

markup-carve / carve-php

PHP parser for Carve, a human-centered lightweight markup language derived from Markdown and Djot.

Maintainers

Package info

github.com/markup-carve/carve-php

Homepage

pkg:composer/markup-carve/carve-php

Transparency log

Fund package maintenance!

dereuromark

Statistics

Installs: 4 695

Dependents: 7

Suggesters: 0

Stars: 2

Open Issues: 5

0.1.6 2026-08-27 00:10 UTC

README

CI Coverage Latest Stable Version Total Downloads PHPStan PHP Version Software License

PHP parser and renderer for Carve, a post-Markdown lightweight markup language with visual mnemonics and human-centered design.

Implements Carve spec 0.1 (see Versioning & Changelog).

Origins

Carve-PHP is a hard fork of djot-php by the PHP Collective. The fork preserves the architecture, AST, renderer pipeline, profiles, and extensions, and replaces Djot's syntax rules with Carve's. The MIT license carries over; copyright lines remain in LICENSE.

For the original Djot implementation, use php-collective/djot instead.

Installation

composer require markup-carve/carve-php

Usage

use MarkupCarve\Carve\CarveConverter;

$converter = new CarveConverter();
$html = $converter->convert('# Hello /Carve/');

HTML migration can include an explicit loss report: HTML, Markdown, Djot and BBCode convert in as well. Only the HTML importer drops anything, and only it takes a mode and a loss report - see docs/html-import.md.

Besides HTML the converter renders Markdown, plain text and ANSI. The Markdown writer's options are in docs/markdown-output.md, and every node can carry its source line - docs/source-lines.md.

CLI

vendor/bin/carve README.crv > README.html   # render (HTML by default)
vendor/bin/carve --markdown README.crv      # or --plain, --ansi, --json
vendor/bin/carve lint README.crv            # report problems, change nothing
vendor/bin/carve migrate --from html p.html # convert into Carve

Every subcommand and flag is in docs/cli.md.

Sandbox

Try this implementation live in the Carve sandbox - explore syntax and extensions, inspect output, and share snippets via pastebin-style links. It also powers the wp-carve WordPress plugin.

ProseMirror / Tiptap

The AST converts to a ProseMirror document and back, so a Tiptap editor in the browser and PHP rendering on the server share one source of truth with no Node runtime. See docs/prosemirror.md.

Untrusted input

Rendering attacker-controlled Carve needs the safe path, which escapes raw HTML instead of emitting it and bounds nesting depth. The threat model, the defaults and the full checklist are in docs/security.md.

Linting

carve lint reports constructs that parse but render differently from what the author intended. The rules and options are in docs/lint.md.

Documentation