remarkd is a PHP-first Markdown parser with selected AsciiDoc-style blocks, document attributes, conditionals, and object macros.
Full usage documentation is available as a static, multi-page site in docs/. The site covers getting started in all three languages, the concepts behind the format, a complete feature reference with live previews, an interactive playground, and the cross-language conformance suite.
The pages use ES modules, which browsers block over file://. Serve the
directory over HTTP to preview locally (GitHub Pages already serves over HTTP,
so the published site works as-is):
npm run serve:docs # then open http://localhost:8000Writers don't need any of this — the documentation site covers how to write Remarkd. The instructions below are for developers embedding a parser.
composer require packaged/remarkduse Packaged\Remarkd\Remarkd;
$html = (new Remarkd())->parse("# Heading\n\nA **bold** paragraph.");go get github.com/packaged/remarkdimport "github.com/packaged/remarkd"
html := remarkd.Parse("# Heading\n\nA **bold** paragraph.")npm install
npm run buildimport { Remarkd } from "remarkd-js";
const html = Remarkd.parse("# Heading\n\nA **bold** paragraph.");Pass a truthy second argument to enable AsciiDoc-style document detection: a
leading = Title, optional author and revision lines, and document attributes
are read as a header before the body is parsed.
$html = $remarkd->parse($text, true); // PHPhtml := remarkd.Parse(text, true) // Goconst html = Remarkd.parse(text, true); // TSUse include::path/to/file.remarkd[] to render another Remarkd document in
place. The included file is parsed as its own document, so its section wrapper is
preserved.
include::shared/intro.remarkd[]
Remarkd includes local partials with t::partial::path/to/file.remarkd.
Paths resolve from the parser's project root, or from the current process path
when no project root is set.
$remarkd = new Remarkd();
$remarkd->ctx()->setProjectRoot(__DIR__ . '/docs');
$html = $remarkd->parse("t::partial::shared/intro.remarkd");html := remarkd.ParseWithOptions(
"t::partial::shared/intro.remarkd",
remarkd.Options{ProjectRoot: "docs"},
)const html = Remarkd.parse("t::partial::shared/intro.remarkd", false, {
projectRoot: "docs",
});For document-shaped partials, use explicit options to remove a leading document title and trailing lines:
t::partial::shared/page.remarkd[strip-title,drop-last=3]
This repository includes PHP, Go, and TypeScript parsers. All three
implementations are kept aligned with the shared fixtures in
requirements/features.
Each requirement fixture contains input.remarkd and expected.html. The
current suite covers 57 user-facing syntax features. Run the language-specific
conformance checks with:
vendor/bin/phpunit tests/RequirementsTest.php
go test ./go
npm run test:tsThe help site is designed for GitHub Pages from the docs/ directory. Pages are
hand-authored HTML that share a stylesheet and a few small ES modules; the
shared navigation is injected by docs/assets/site.js, and the feature
reference and conformance pages render from one data module,
docs/assets/features.js. The playground and previews are powered by the
TypeScript parser bundle.
Refresh the generated assets after parser changes:
npm run build:docsThis rebuilds the playground bundle and regenerates
docs/assets/conformance-status.json, which records whether each parser (PHP,
Go, TypeScript) reproduces every fixture. The conformance page reads it for the
PHP and Go columns and computes the TypeScript column live in the browser.
Regenerating the JSON requires the php and go toolchains locally; if either
is missing, that column is recorded as unbuilt and the build still succeeds.
The documented examples (sources and expected HTML) are checked against the fixtures so they cannot silently drift:
npm run check:examplesThen configure GitHub Pages to publish from docs/ on the desired branch.