diff --git a/composer.json b/composer.json index bcce536..5988e6a 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "require": { "erusev/parsedown": "^1.7", - "keinos/parsedown-toc": "dev-master" + "hoegh/parsedown-toc": "^1.3" } } diff --git a/css/main.css b/css/main.css index 768d5b2..ef92499 100644 --- a/css/main.css +++ b/css/main.css @@ -8,16 +8,20 @@ "menu main toc" "footer footer footer"; } - - .toc>* { - position: fixed; - } } +html { + scroll-behavior: smooth; + } + body { max-width: 1000px; } +.backTop { + content: "test"; +} + .menu { grid-area: menu; font-size: .9rem; @@ -30,6 +34,7 @@ body { .toc { grid-area: toc; font-size: .9rem; + overflow: scroll; } .toc ul { diff --git a/index.php b/index.php index 80a80c7..335fd36 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ require 'vendor/autoload.php'; require 'apps/apps.php'; -$dir = $_GET['dir'] ?? ''; +$dir = $_GET['dir'] ?? ''; $file = $_GET['file'] ?? ''; if (!empty($dir)) { @@ -15,7 +15,7 @@ if (isset($file)) { if (empty($file) || !file_exists('content/' . urldecode($dir) . '/' . urldecode($file) . '.md')) { $dir = ''; - if(file_exists('content/index.md')){ + if (file_exists('content/index.md')) { $file = 'index'; } else { $file = 'default'; @@ -26,13 +26,16 @@ if (empty($file) || !file_exists('content/' . urldecode($dir) . '/' . urldecode( $Parsedown = new ParsedownToc(); $content = file_get_contents('content/' . urldecode($dir) . '/' . urldecode($file) . '.md'); +$options = array('selectors' => array('h2', 'h3')); -$Parsedown = new ParsedownToc(); +$Parsedown = new ParsedownToc($options); $body = $Parsedown->text($content); $toc = $Parsedown->contentsList(); $body = str_replace("[ ]", '', $body); $body = str_replace("[x]", '', $body); +$body = str_replace("", ' ⬆️', $body); +$body = str_replace("", ' ⬆️', $body); require 'tpl/header.html'; require 'tpl/aside.html';