Markdown Syntax highlighting

Vitesse theme
Draft tag in posts
leg
This commit is contained in:
Michał Gdula 2024-05-25 12:39:20 +01:00
parent fcc026d06d
commit a09d21f28c
11 changed files with 1359 additions and 49 deletions

View file

@ -10,30 +10,43 @@ const { Content } = await post.render();
<a class="button" href="/" id="home">Home</a>
<h1>{post.data.title}</h1>
<p>{post.data.description}</p>
<ul id="tags" class="pill-list">
{post.data.tags.map((item: string) => ( <li class="pill">#{item}</li> ))}
</ul>
<div class="header">
<h1>{post.data.title}</h1>
<p>{post.data.description}</p>
<ul id="tags" class="pill-list">
{post.data.tags.map((item: string) => ( <li class="pill">#{item}</li> ))}
</ul>
</div>
<hr>
<div id="markdown">
<Content />
<Content />
</div>
<hr>
<ul id="controls">
<li>{prev && <a class="button" href=`${base}/${prev.slug}` id="prev">{prev.data.title}</a>}</li>
<li>{next && <a class="button" href=`${base}/${next.slug}` id="next">{next?.data.title}</a>}</li>
<li>
{prev && (
<a class="button" href=`${base}/${prev.slug}` id="prev">
{ prev.data.title }
</a>
)}
</li>
<li>
{next && (
<a class="button" href=`${base}/${next.slug}` id="next">
{ next?.data.title }
</a>
)}
</li>
</ul>
<style is:global lang="scss">
@import "../styles/vars";
#home { margin-bottom: 32px; }
#tags { padding-top: 16px; }
#controls {
display: flex;
@ -43,6 +56,10 @@ const { Content } = await post.render();
> li {
list-style: none;
> .button {
// background-color: transparent;
}
}
}
@ -50,7 +67,10 @@ const { Content } = await post.render();
flex-grow: 1;
h1, h2, h3, h4, h5, h6 {
padding-bottom: 16px;
padding-bottom: 8px;
}
h2, h3, h4, h5, h6 {
padding-top: 16px;
}
p {
@ -77,7 +97,7 @@ const { Content } = await post.render();
border-top: 2px solid $gray;
}
code {
p code {
padding: 2px 4px;
font-size: 13px;
@ -89,28 +109,102 @@ const { Content } = await post.render();
overflow-x: auto
}
pre {
padding: 8px;
white-space: pre-wrap;
word-wrap: break-word;
border-radius: $radius;
background-color: $gray !important;
color: $light;
overflow-x: scroll;
> code {
padding: 0;
}
}
blockquote {
margin: 8px 0 8px 16px;
padding: 0 8px;
font-style: italic;
border-left: 2px solid $orange;
}
table {
width: 100%;
border: 1px solid $gray;
border-collapse: collapse;
tr {
border-bottom: 1px solid $gray;
&:last-of-type {
border: 0 solid transparent;
}
th, td {
padding: 8px 16px;
font-size: 13px;
border-right: 1px solid $gray;
&:last-of-type {
border: 0 solid transparent;
}
}
th {
font-weight: bolder;
background-color: $gray;
}
}
}
// pre {
// padding: 8px;
//
// white-space: pre-wrap;
// word-wrap: break-word;
//
// border-radius: $radius;
// background-color: $gray !important;
// color: $light;
//
// overflow-x: scroll;
//
// > code {
// padding: 0;
// }
// }
.astro-code {
padding: 36px 8px 8px;
position: relative;
display: block;
border-radius: $radius;
&::before {
content: "lang: " attr(data-language);
padding: 4px 8px;
width: 100%;
height: 28px;
position: absolute;
top: 0;
left: 0;
font-size: 13px;
background-color: $gray;
color: $light;
}
}
.footnotes {
margin-top: 32px;
padding: 16px;
border-radius: $radius;
background-color: $gray;
> h2 {
padding-top: 0;
}
}
}
</style>