Skip to content

Commit

Permalink
Merge pull request #149 from jonnyeom/feature/small-cleanup
Browse files Browse the repository at this point in the history
Feature/small cleanup
  • Loading branch information
jonnyeom authored Jun 20, 2024
2 parents bd21cad + 83a0a56 commit 915bac7
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 4 deletions.
4 changes: 2 additions & 2 deletions assets/styles/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $orange: #A6664B;
$react-blue: #61dafb;
$solr-orange: #D9411E;
$strava-orange: #FC4C02;
$theme-blue: #DFE6E4;
$theme-blue: rgb(76, 97, 91);
$vue-green: #42b983;
$php-purple: #8892BF;
$php-dark-purple: #4F5B93;
Expand Down Expand Up @@ -99,7 +99,7 @@ $grey-lightest: hsl(0, 0%, 93%);
@forward "bulma/sass/layout/container";
@use "bulma/sass/layout/footer" with (
$footer-padding: 3rem 1.5rem 8rem,
$footer-background-color: $theme-blue
$footer-background-color: hsla(var(--bulma-theme-blue-h),var(--bulma-theme-blue-s),var(--bulma-theme-blue-l),.2)
);
@forward "bulma/sass/layout/section";

Expand Down
2 changes: 2 additions & 0 deletions assets/styles/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ nav.menu {

.heading-permalink {
color: transparent;
font-size: .8em;
margin-left: .25rem;
text-decoration: none;
vertical-align: super;
visibility: hidden;
}

Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"require": {
"php": "^8.3",
"ext-intl": "*",
"api-platform/core": "^3.2.24",
"basvandorst/stravaphp": "^2.0",
"doctrine/annotations": "^2.0.1",
Expand Down
5 changes: 3 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions src/Content/Medical.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{.has-text-centered}
# Medical
{.has-text-centered}
> This page is for medical + informational purposes only.
>
[TOC]

### No Blood
I, Jonathan Eom, direct that NO TRANSFUSIONS of whole blood, red cells, white cells, platelets, or plasma be
given me under any circumstances, even if health-care providers believe that such are necessary to preserve my life.

17 changes: 17 additions & 0 deletions src/Controller/DefaultController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace App\Controller;

use App\Service\MarkdownConverter;
use League\CommonMark\CommonMarkConverter;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -93,4 +94,20 @@ public function experiments(): Response
{
return $this->render('page/experiments.html.twig');
}

#[Route(path: '/medical', name: 'app_medical')]
public function medical(): Response
{
$cache = new FilesystemAdapter();

$content = $cache->get('markdown_about', static function (ItemInterface $item) {
$converter = new MarkdownConverter();
$markdown = file_get_contents(__DIR__ . '/../Content/Medical.md');
assert(is_string($markdown));

return $converter->convert($markdown);
});

return $this->render('page/medical.html.twig', ['content' => $content]);
}
}
37 changes: 37 additions & 0 deletions src/Service/MarkdownConverter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

namespace App\Service;

use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Attributes\AttributesExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
use League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension;
use League\CommonMark\Extension\TableOfContents\TableOfContentsExtension;

final class MarkdownConverter extends \League\CommonMark\MarkdownConverter
{
public function __construct()
{
$environment = new Environment([
'table_of_contents' => [
'html_class' => 'table-of-contents',
'position' => 'placeholder',
'style' => 'bullet',
'min_heading_level' => 2,
'max_heading_level' => 6,
'normalize' => 'relative',
'placeholder' => '[TOC]',
],
'heading_permalink' => ['insert' => 'after'],
]);

$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new HeadingPermalinkExtension());
$environment->addExtension(new TableOfContentsExtension());
$environment->addExtension(new AttributesExtension());

parent::__construct($environment);
}
}
13 changes: 13 additions & 0 deletions templates/page/medical.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{% extends 'base.html.twig' %}

{% block body %}
<section class="section pt-0">
<div class="container is-max-desktop">
<div class="content">
<div class=markdown">
{{ content|raw }}
</div>
</div>
</div>
</section>
{% endblock %}
2 changes: 2 additions & 0 deletions tests/Controller/DefaultControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public function getPublicUrls(): Generator
yield ['/projects'];
yield ['/writing'];
yield ['/about'];
yield ['/experiments'];
yield ['/medical'];
yield ['/strava'];
}
}

0 comments on commit 915bac7

Please sign in to comment.