PHP parser and renderer for Carve, a lightweight markup language for readable source and structured documents.
Implements Carve spec 0.1 (see Versioning & Changelog).
composer require markup-carve/carve-phpHTML import and HTML heading-ID conversion require the PHP DOM extension
(ext-dom). Core Carve parsing and rendering do not require it.
use MarkupCarve\Carve\CarveConverter;
$converter = new CarveConverter();
$html = $converter->convert('# Hello /Carve/');The converter also renders Markdown, plain text and ANSI. PHP integration options are in the PHP guides.
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 CarveSee the CLI guide for all subcommands and flags.
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.
Use the safe rendering options for untrusted documents. They disable raw HTML passthrough and bound nesting depth.
- Carve documentation: syntax, examples, optional features and format conversion.
- PHP guides: configuration, importers, output formats and editor integration.
- Developer documentation: contributing, custom renderers, parser internals and benchmarks.
Table body partitions and source attributes are documented in Table source metadata.