Files
DomFramework/tools/markdown.php

30 lines
617 B
PHP
Executable File

#!/usr/bin/php
<?php
require_once(__DIR__ . "/../src/markdown.php");
if (! isset($argv[1])) {
file_put_contents(
"php://stderr",
"No file to convert in markdown provided\n"
);
exit(1);
}
if (! file_exists($argv[1])) {
file_put_contents(
"php://stderr",
"The file to convert in markdown doesn't exists\n"
);
exit(2);
}
if (! is_readable($argv[1])) {
file_put_contents(
"php://stderr",
"The file to convert in markdown is not readable\n"
);
exit(3);
}
$md = new Domframework\Markdown();
echo $md->html(file_get_contents($argv[1]));