/**
* Create a new GitDown parser instance.
*
* @param $directory string
* @throws RuntimeException if GitRuntimeException caught
* @throws InvalidArgumentException if GitInvalidArgumentException caught
*/
public function __construct($directory)
{
try {
$this->repository = new Repository($directory);
$this->commit = $this->repository->getHeadCommit();
} catch (GitInvalidArgumentException $e) {
throw new InvalidArgumentException($e->getMessage());
} catch (GitRuntimeException $e) {
throw new RuntimeException($e->getMessage());
}
}