code highlighting

This commit is contained in:
Michal Vanko 2020-09-26 15:08:17 +02:00
parent dcfc3eccc2
commit 46195dc3d3
2 changed files with 8 additions and 7 deletions

View File

@ -1,7 +1,5 @@
<script context="module"> <script context="module">
export async function preload({ params, query }) { export async function preload({ params, query }) {
// the `slug` parameter is available because
// this file is called [slug].svelte
const res = await this.fetch(`blog/${params.slug}.json`) const res = await this.fetch(`blog/${params.slug}.json`)
const data = await res.json() const data = await res.json()
@ -15,6 +13,7 @@
<script> <script>
import ArticleFooter from '../../components/blog/article-footer.svelte' import ArticleFooter from '../../components/blog/article-footer.svelte'
import '../../../static/prism.js'
export let post export let post
</script> </script>
@ -65,9 +64,6 @@
<svelte:head> <svelte:head>
<title>{post.title}</title> <title>{post.title}</title>
<link rel="stylesheet" href="/prism.css" /> <link rel="stylesheet" href="/prism.css" />
<script src="../../../static/prism.js" defer>
</script>
</svelte:head> </svelte:head>
<h1>{post.title}</h1> <h1>{post.title}</h1>
@ -75,5 +71,4 @@
<div class="content"> <div class="content">
{@html post.body} {@html post.body}
</div> </div>
<ArticleFooter post={post} /> <ArticleFooter {post} />

View File

@ -62,6 +62,7 @@ code,
pre { pre {
font-family: menlo, inconsolata, monospace; font-family: menlo, inconsolata, monospace;
font-size: 0.92em; font-size: 0.92em;
line-height: 1.24em;
background-color: #f0f0f0; background-color: #f0f0f0;
padding: 0.2em 0.4em; padding: 0.2em 0.4em;
color: #464646; color: #464646;
@ -126,4 +127,9 @@ p {
body { body {
font-size: 24px; font-size: 24px;
} }
code,
pre {
font-size: 0.8em;
}
} }