<?php   // Functions

function markdownContent($filePath, $rootFilePath) {
    $markdownContent = file_get_contents($filePath);
    require_once $rootFilePath . 'include/parsedown.php';
    $parsedown = new Parsedown();
    return $parsedown->text($markdownContent);
}

function sqlConnect($dbHost, $dbName, $dbUser, $dbPass) {
    try {
        $pdo = new PDO('mysql:host=' . $dbHost . ';dbname=' . $dbName . ';charset=UTF8mb4', $dbUser, $dbPass);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

    } catch(Exception $e) {
        die('<div class="error-message"><span><?=$e->getMessage();?></span></div>');
    }

    return $pdo;
}
?>