Add support for table in markdown

Update default theme for more semantic bone
This commit is contained in:
Knah Tsaeb 2024-12-31 15:39:50 +01:00
parent 3745cf1f03
commit 1902674a8b
3 changed files with 139 additions and 59 deletions

View file

@ -6,6 +6,7 @@ use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\TaskList\TaskListExtension;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\MarkdownConverter;
use Utils\Utils;
@ -396,6 +397,7 @@ class FileAndDir {
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new TaskListExtension());
$environment->addExtension(new AutolinkExtension());
$environment->addExtension(new TableExtension());
$converter = new MarkdownConverter($environment);
return $converter->convert($content)->getContent();
} else {
@ -452,6 +454,7 @@ class FileAndDir {
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new TaskListExtension());
$environment->addExtension(new AutolinkExtension());
$environment->addExtension(new TableExtension());
$converter = new MarkdownConverter($environment);
if (!empty($exifData)) {

View file

@ -1,7 +1,100 @@
* {
/* RESET CSS BY Piccalil.li */
/* https://piccalil.li/blog/a-more-modern-css-reset/ */
/* License https://creativecommons.org/licenses/by/3.0/ */
/* Box sizing rules */
*,
*::before,
*::after {
box-sizing: border-box;
}
/* Prevent font size inflation */
html {
-moz-text-size-adjust: none;
-webkit-text-size-adjust: none;
text-size-adjust: none;
}
/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
margin-block-end: 0;
}
/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role='list'],
ol[role='list'] {
list-style: none;
}
/* Set core body defaults */
body {
min-height: 100vh;
line-height: 1.5;
}
/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
h4,
h5,
h6,
button,
input,
label {
line-height: 1.1;
}
/* Balance text wrapping on headings */
h1,
h2,
h3,
h4,
h5,
h6 {
text-wrap: balance;
margin: calc(var(--default-space)*2) 0;
}
/* Make images easier to work with */
/*img,
picture {
max-width: 100%;
display: block;
}*/
/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
font-family: inherit;
font-size: inherit;
}
/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
min-height: 10em;
}
/* Anything that has been anchored to should have extra scroll margin */
:target {
scroll-margin-block: 5ex;
}
html {
scroll-behavior: smooth;
}
@ -105,6 +198,11 @@ a:not(.card-content):hover {
text-decoration-thickness: var(--default-space);
}
p,
.gslide-description p {
margin: calc(var(--default-space) /1.5) 0;
}
#logo-border-color {
fill: var(--primary) !important;
stroke: none !important;
@ -121,16 +219,6 @@ a:not(.card-content):hover {
stroke: #000 !important;
}
aside {
color: var(--light-text-color);
background-color: var(--light-background-color);
padding: calc(var(--default-space) * 2);
border: 1px solid var(--background-color-darken);
border-radius: calc(var(--default-space) * 1.2);
margin: 0 0 calc(var(--default-space) *5) 0;
box-shadow: var(--box-shadow-light);
}
main,
.message {
max-width: 100%;
@ -152,28 +240,8 @@ img {
border: none;
}
body>nav {
text-align: center;
}
aside {
padding-bottom: 0.3em;
}
aside a {
color: var(--primary);
text-decoration: none;
}
aside * {
margin: .2em 0;
}
article,
section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
gap: var(--default-space);
color: var(--light-text-color);
background-color: var(--light-background-color);
padding: calc(var(--default-space) * 2);
@ -183,7 +251,14 @@ section {
box-shadow: var(--box-shadow-light);
}
article {
section {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
gap: var(--default-space);
}
figure {
background-color: var(--light-background-color);
display: grid;
grid-template-columns: repeat(1, 1fr);
@ -194,15 +269,15 @@ article {
width: min-content;
}
article a {
figure a {
display: flex;
}
.card-footer {
figcaption {
color: var(--header-text-color);
margin: 0;
overflow: hidden;
padding: .3em .6em;
padding: 0;
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;

View file

@ -81,38 +81,40 @@ use App\FileAndDir;
</ul>
</nav>
</header>
<?php if ($breadcrumb_navigation): ?>
<article>
<nav aria-label="breadcrumb" class="breadcrumb">
<?= $breadcrumb_navigation; ?>
</nav>
</article>
<?php endif; ?>
<?php if ($folderNote): ?>
<article>
<?= $folderNote; ?>
</article>
<?php endif; ?>
<?php if (!empty($messages)) : ?>
<article id="message" class="message">
<?= $messages; ?>
</article>
<?php endif; ?>
<main>
<section>
<?php if ($breadcrumb_navigation): ?>
<nav aria-label="breadcrumb" class="breadcrumb">
<?= $breadcrumb_navigation; ?>
</nav>
<?php endif; ?>
<?php if ($folderNote): ?>
<aside>
<?= $folderNote; ?>
</aside>
<?php endif; ?>
<?php if (!empty($messages)) : ?>
<div id="message" class="message">
<?= $messages; ?>
</div>
<?php endif; ?>
</section>
<section>
<?php foreach ($listDir as $value) : ?>
<?php foreach ($value as $entry) : ?>
<article>
<figure>
<a href="<?= $entry['link']; ?>" class="<?= FileAndDir::addToLightBox($entry['type']); ?> card-content" data-gallery="gallery" data-glightbox="<?= $entry['dataAttr']; ?>">
<img src="<?= $entry['thumb']; ?>" loading="lazy" alt="" width="<?= $config['thumbSize']; ?>" height="<?= $config['thumbSize']; ?>">
</a>
<p class="card-footer">
<figcaption>
<?= $entry['name']; ?>
</p>
</figcaption>
<?= $entry['imgCaption']; ?>
</article>
</figure>
<?php endforeach; ?>
<?php endforeach; ?>
</section>