diff --git a/index.php b/index.php index 8ae972a..79e7a64 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,6 @@ require __DIR__."/vendor/autoload.php"; -$source = file_get_contents(dirname(__FILE__)."/README.md"); echo " "; -$Instance = new parkdown\Parkdown($source); -echo $Instance->html(); \ No newline at end of file +$file = dirname(__FILE__)."/README.md"; +$source = file_get_contents($file); + +try { + $Instance = new parkdown\Parkdown($source, true, $file); + echo $Instance->html(); +} catch (AssertionError $error) { + echo "
"; + + $message = explode(" ", $error->getMessage()); + $location = array_shift($message); + $file = explode(":", $location)[0]; + + if ($file === "INPUT_STRING") + echo "$location ".implode(" ", $message); + else + echo "$location ".implode(" ", $message); + + + $stackTrace = explode("\n", $error->getTraceAsString()); + array_shift($stackTrace); + + echo ""; + foreach ($stackTrace as $step) { + $step = explode(" ", $step); + array_shift($step); + $location = array_shift($step); + $location = preg_replace("/\(([0-9]+)\):/", ":\$1:", $location); + + echo "$location ".implode(" ", $step)."
"; +} \ No newline at end of file
"; + } + echo "