You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.0 KiB
35 lines
1.0 KiB
<?php declare(strict_types=1);
|
|
|
|
require __DIR__."/../vendor/autoload.php";
|
|
|
|
$source = file_get_contents("php://input");
|
|
|
|
try {
|
|
$Instance = new parkdown\Parkdown($source, true);
|
|
echo $Instance->html();
|
|
} catch (parkdown\ParserError $error) {
|
|
echo "<pre>";
|
|
|
|
$message = explode(" ", $error->getMessage());
|
|
$location = array_shift($message);
|
|
$loc = explode(":", $location);
|
|
$file = array_shift($loc);
|
|
$line = substr(implode(":", $loc), 0, -1);
|
|
[$row, $col] = explode(":", $line);
|
|
|
|
echo "<a class='error' href=\"javascript: highlight($col, $row);\">$location</a> ".implode(" ", $message);
|
|
|
|
|
|
$stackTrace = explode("\n", $error->getTraceAsString());
|
|
|
|
echo "<p><small>";
|
|
foreach ($stackTrace as $step) {
|
|
$step = explode(" ", $step);
|
|
array_shift($step);
|
|
$location = array_shift($step);
|
|
$location = preg_replace("/\(([0-9]+)\):/", ":\$1:", $location);
|
|
|
|
echo "<a class='error' href='vscode://file/".substr($location, 0, -1)."'>$location</a> ".implode(" ", $step)."<br>";
|
|
}
|
|
echo "</small></p>";
|
|
} |