markup-carve / carve-php
PHP parser for Carve, a lightweight markup language for documents and the web.
Fund package maintenance!
Requires
- php: ^8.2
Requires (Dev)
- brianium/paratest: ^7.8
- nikic/php-fuzzer: ^0.0.11
- php-collective/code-sniffer: ^0.6.8
- phpstan/phpstan: ^2.1.32
- phpunit/phpunit: ^11.0 || ^12.0 || ^13.0
Suggests
- ext-dom: Required for HTML import and HTML heading-ID conversion.
- ext-intl: Recommended for heading-ID transliteration: enables ICU romanization of non-Latin scripts (e.g. CJK, Arabic). Without it, a baked map covers Latin/Cyrillic/punctuation identically and other scripts fall back to the generated `section` id.
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 0.1.10
- 0.1.9
- 0.1.8
- 0.1.7
- 0.1.6
- 0.1.5
- 0.1.4
- 0.1.3
- 0.1.2
- 0.1.1
- 0.1.0
- 0.1.0-RC1
- dev-perf/residual-scaling-20261004
- dev-ci/drift-verdict-stays-green
- dev-refactor/rebase-extents-20261004
- dev-refactor/parser-decisions-20261004
- dev-ci/checks-required-or-deleted
- dev-perf/remaining-scaling-20261004
- dev-perf/list-chain-render
- dev-perf/architecture-completion-20261004
- dev-next
This package is auto-updated.
Last update: 2026-10-04 11:00:13 UTC
README
PHP parser and renderer for Carve, a lightweight markup language for readable source and structured documents.
Implements Carve spec 0.1 (see Versioning & Changelog).
Installation
composer require markup-carve/carve-php
HTML import and HTML heading-ID conversion require the PHP DOM extension
(ext-dom). Core Carve parsing and rendering do not require it.
Usage
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.
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
See the CLI guide for all subcommands and flags.
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.
Untrusted input
Use the safe rendering options for untrusted documents. They disable raw HTML passthrough and bound nesting depth.
Documentation
- 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.