29declare(strict_types = 1);
31if ($argc !== 2 || !is_file($argv[1])) {
32 fwrite(STDERR,
"Expected a Markdown input filename.\n");
39echo preg_replace_callback(
'~\[([^\]]+)\]\((?:\.\./)?(README\.md|LICENSE|docs/guide\.md|docs/Doxyfile|update\.sh|deploy\.sh|demo/run\.sh|demo/demo\.php|tests/demo\.php|tests/benchmarks/query-2026-10-07\.json|tests/benchmarks/postgres-2026-10-09\.json)(#[^)]*)?\)~',
40 static function(array $match):
string {
42 'README.md' =>
'index.html',
43 'LICENSE' =>
'https://opensource.org/license/mit/',
44 'docs/guide.md' =>
'md_docs_2guide.html',
45 'docs/Doxyfile' =>
'documentation_guide.html#doxygen-configuration',
46 'deploy.sh' =>
'documentation_guide.html#deployment-command',
47 'update.sh' =>
'documentation_guide.html#update-command',
48 'demo/run.sh' =>
'documentation_guide.html#demo-command',
49 'demo/demo.php' =>
'demo_2demo_8php.html',
50 'tests/demo.php' =>
'tests_2demo_8php.html',
51 'tests/benchmarks/query-2026-10-07.json' =>
'query-2026-10-07.json',
52 'tests/benchmarks/postgres-2026-10-09.json' =>
'postgres-2026-10-09.json',
54 return '<a href="'.$target.($match[3] ??
'').
'">'.htmlspecialchars($match[1], ENT_QUOTES | ENT_SUBSTITUTE,
'UTF-8').
'</a>';
if($argc !==2||!is_file($argv[1])) $markdown