Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5b24dc9bf | ||
|
|
99867aa03e | ||
|
|
65f4dd1ac5 |
Binary file not shown.
|
After Width: | Height: | Size: 806 B |
@@ -0,0 +1,40 @@
|
|||||||
|
---
|
||||||
|
title: Demo
|
||||||
|
author: kleπek
|
||||||
|
draft: false
|
||||||
|
thumbnail: ./thumbnail.jpg
|
||||||
|
date: 2026-01-01
|
||||||
|
---
|
||||||
|
|
||||||
|
## Images
|
||||||
|
|
||||||
|
PNG: 
|
||||||
|
|
||||||
|
## highlight.js
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function test(arg1: string, arg2: number): string {
|
||||||
|
return `${arg1}: ${arg2}`
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```text
|
||||||
|
text/plain
|
||||||
|
```
|
||||||
|
|
||||||
|
## Mermaid
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
A --> B
|
||||||
|
```
|
||||||
|
|
||||||
|
## LaTex
|
||||||
|
|
||||||
|
$$\Large\color{Red}{\frac{\Delta K}{2}=\frac{T_{2}}{x_{2}(x_{2}-x_{1})}-\frac{T_{1}}{x_{1}(x_{2}-x_{1})}}$$
|
||||||
|
|
||||||
|
Inline LaTex $$\frac{\Delta K}{2}$$ in text
|
||||||
|
|
||||||
|
## Lucide Icons
|
||||||
|
|
||||||
|
Icon inside <i icon="atom"></i> text
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"base_url": "http://localhost/",
|
||||||
|
"title": "<i icon=notepad-text></i> My Blog",
|
||||||
|
"signature": "By <b>Me</b>",
|
||||||
|
"lang": "en",
|
||||||
|
"custom_head": "",
|
||||||
|
"home_count": 5,
|
||||||
|
"rss_link": "<i icon=rss></i> RSS",
|
||||||
|
"back_link": "<i icon=undo-2></i> Back to home",
|
||||||
|
"published_on": "Published on",
|
||||||
|
"copyright": "<a style=\"text-decoration:none;color:inherit;\" target=_blank href=\"https://creativecommons.org/licenses/by-nc/4.0/\">CC BY-NC</a>"
|
||||||
|
}
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
/*
|
||||||
|
=================================================
|
||||||
|
https://www.joshwcomeau.com/css/custom-css-reset/
|
||||||
|
=================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
1. Use a more-intuitive box-sizing model.
|
||||||
|
*/
|
||||||
|
*,
|
||||||
|
*::before,
|
||||||
|
*::after {
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
2. Remove default margin
|
||||||
|
*/
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
3. Allow percentage-based heights in the application
|
||||||
|
*/
|
||||||
|
html,
|
||||||
|
body, div#app {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
Typographic tweaks!
|
||||||
|
4. Add accessible line-height
|
||||||
|
5. Improve text rendering
|
||||||
|
*/
|
||||||
|
body {
|
||||||
|
line-height: 1.5;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
6. Improve media defaults
|
||||||
|
*/
|
||||||
|
img,
|
||||||
|
picture,
|
||||||
|
video,
|
||||||
|
canvas,
|
||||||
|
svg {
|
||||||
|
display: block;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
7. Remove built-in form typography styles
|
||||||
|
*/
|
||||||
|
input,
|
||||||
|
button,
|
||||||
|
textarea,
|
||||||
|
select {
|
||||||
|
font: inherit;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
8. Avoid text overflows
|
||||||
|
*/
|
||||||
|
p,
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
9. Create a root stacking context
|
||||||
|
*/
|
||||||
|
#root,
|
||||||
|
#__next {
|
||||||
|
isolation: isolate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================================================
|
||||||
|
https://blog.koley.in/2019/339-bytes-of-responsive-css
|
||||||
|
https://www.swyx.io/css-100-bytes
|
||||||
|
https://gist.github.com/JoeyBurzynski/617fb6201335779f8424ad9528b72c41
|
||||||
|
=================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
padding: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
color: #222;
|
||||||
|
font-family: Verdana, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 1.5rem;
|
||||||
|
margin: auto;
|
||||||
|
background-color: #ccc;
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3,
|
||||||
|
h4,
|
||||||
|
h5,
|
||||||
|
h6 {
|
||||||
|
margin: 1em 0 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
p,
|
||||||
|
ul,
|
||||||
|
ol,
|
||||||
|
pre,
|
||||||
|
img,
|
||||||
|
blockquote,
|
||||||
|
details {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
color: #444;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
opacity: 25%;
|
||||||
|
border-bottom: 0;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea,
|
||||||
|
input,
|
||||||
|
select,
|
||||||
|
pre,
|
||||||
|
.mono {
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (min-width: 768px) {
|
||||||
|
main {
|
||||||
|
max-width: 42rem;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MD BLOG
|
||||||
|
*/
|
||||||
|
|
||||||
|
nav {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home nav {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
vertical-align: text-bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.home .nav-title {
|
||||||
|
font-size: xx-large;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .nav-title {
|
||||||
|
font-size: larger;
|
||||||
|
font-weight: bold;
|
||||||
|
color: inherit;
|
||||||
|
display: inline-block;
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav .nav-items {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-published {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
|
.link-home {
|
||||||
|
text-decoration: none;
|
||||||
|
float: right;
|
||||||
|
line-height: 2.4;
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "md-blog",
|
"name": "md-blog",
|
||||||
"version": "1.5.0",
|
"version": "1.7.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": "https://github.com/klemek/md-blog",
|
"repository": "https://github.com/klemek/md-blog",
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { BASE_URL, TITLE, RSS_LINK } from '@/lib/meta'
|
import { BASE_URL, TITLE, RSS_LINK } from '@lib/config'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { REPOSITORY, NAME, VERSION, TITLE, COPYRIGHT } from '@/lib/meta'
|
import { REPOSITORY, NAME, VERSION, TITLE, COPYRIGHT } from '@lib/config'
|
||||||
import { stripHTML } from '@/lib/strings';
|
import { stripHTML } from '@lib/strings'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<footer>
|
<footer>
|
||||||
{{ stripHTML(TITLE) }} © {{ new Date().getFullYear() }}, <span v-html="COPYRIGHT"></span> | Made with
|
{{ stripHTML(TITLE) }} © {{ new Date().getFullYear() }}, <span v-html="COPYRIGHT"></span> |
|
||||||
|
Made with
|
||||||
<a :href="REPOSITORY">{{ NAME }} {{ VERSION }}</a>
|
<a :href="REPOSITORY">{{ NAME }} {{ VERSION }}</a>
|
||||||
</footer>
|
</footer>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
+4
-2
@@ -5,13 +5,15 @@ function parseMetadata(
|
|||||||
srcAttributes: Record<string, unknown>,
|
srcAttributes: Record<string, unknown>,
|
||||||
pathPrefix: string,
|
pathPrefix: string,
|
||||||
): ArticleMetadata {
|
): ArticleMetadata {
|
||||||
|
const draft = !!srcAttributes.draft
|
||||||
return {
|
return {
|
||||||
path: pathPrefix,
|
path: pathPrefix,
|
||||||
title: decodeURIComponent((srcAttributes.title as string) ?? 'Untitled'),
|
title:
|
||||||
|
(draft ? '[DRAFT] ' : '') + decodeURIComponent((srcAttributes.title as string) ?? 'Untitled'),
|
||||||
date: new Date(Date.parse((srcAttributes.date as string) ?? '')),
|
date: new Date(Date.parse((srcAttributes.date as string) ?? '')),
|
||||||
author: decodeURIComponent((srcAttributes.author as string) ?? ''),
|
author: decodeURIComponent((srcAttributes.author as string) ?? ''),
|
||||||
thumbnail: (srcAttributes.thumbnail as string) ?? '',
|
thumbnail: (srcAttributes.thumbnail as string) ?? '',
|
||||||
draft: !!srcAttributes.draft,
|
draft: draft,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import packageJson from '@/../package.json'
|
||||||
|
|
||||||
|
export const NAME: string = packageJson.name
|
||||||
|
export const VERSION: string = packageJson.version
|
||||||
|
export const REPOSITORY: string = packageJson.repository
|
||||||
|
export const TITLE: string = import.meta.env.VITE_APP_TITLE
|
||||||
|
export const SIGNATURE: string = import.meta.env.VITE_APP_SIGNATURE
|
||||||
|
export const COPYRIGHT: string = import.meta.env.VITE_APP_COPYRIGHT
|
||||||
|
export const RSS_LINK: string = import.meta.env.VITE_APP_RSS_LINK
|
||||||
|
export const BACK_LINK: string = import.meta.env.VITE_APP_BACK_LINK
|
||||||
|
export const HOME_COUNT: number = parseInt(import.meta.env.VITE_APP_HOME_COUNT)
|
||||||
|
export const PUBLISHED_ON: string = import.meta.env.VITE_APP_PUBLISHED_ON
|
||||||
|
export const BASE_URL: string = import.meta.env.BASE_URL
|
||||||
|
export const PROD: boolean = import.meta.env.PROD
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import packageJson from '@/../package.json'
|
|
||||||
|
|
||||||
export const NAME = packageJson.name
|
|
||||||
export const VERSION = packageJson.version
|
|
||||||
export const REPOSITORY = packageJson.repository
|
|
||||||
export const TITLE = import.meta.env.VITE_APP_TITLE
|
|
||||||
export const SIGNATURE = import.meta.env.VITE_APP_SIGNATURE
|
|
||||||
export const COPYRIGHT = import.meta.env.VITE_APP_COPYRIGHT
|
|
||||||
export const RSS_LINK = import.meta.env.VITE_APP_RSS_LINK
|
|
||||||
export const BACK_LINK = import.meta.env.VITE_APP_BACK_LINK
|
|
||||||
export const BASE_URL = import.meta.env.BASE_URL
|
|
||||||
+2
-2
@@ -2,8 +2,8 @@ import { createApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
|
|
||||||
import ShaderviewElement from '@keithclark/shaderview';
|
import ShaderviewElement from '@keithclark/shaderview'
|
||||||
customElements.define('kc-shaderview', ShaderviewElement);
|
customElements.define('kc-shaderview', ShaderviewElement)
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ import { loadArticle } from '@lib/articles'
|
|||||||
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
|
import { useRoute, onBeforeRouteUpdate, type RouteLocation } from 'vue-router'
|
||||||
import NotFoundView from './NotFoundView.vue'
|
import NotFoundView from './NotFoundView.vue'
|
||||||
import { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
import { BACK_LINK, SIGNATURE, TITLE } from '@lib/meta'
|
import { BACK_LINK, PUBLISHED_ON, SIGNATURE, TITLE } from '@lib/config'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import PageFooter from '@components/PageFooter.vue'
|
||||||
import { stripHTML } from '@/lib/strings'
|
import { stripHTML } from '@lib/strings'
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@components/NavBar.vue'
|
||||||
|
|
||||||
const article = ref<Article | null>(null)
|
const article = ref<Article | null>(null)
|
||||||
const loading = ref<boolean>(true)
|
const loading = ref<boolean>(true)
|
||||||
@@ -40,8 +40,7 @@ onBeforeRouteUpdate(loadPage)
|
|||||||
<RouterLink class="link-home" to="/"><i icon="undo-2">↑</i></RouterLink>
|
<RouterLink class="link-home" to="/"><i icon="undo-2">↑</i></RouterLink>
|
||||||
<h1 class="article-title" v-html="article.metadata.title"></h1>
|
<h1 class="article-title" v-html="article.metadata.title"></h1>
|
||||||
<div class="article-published">
|
<div class="article-published">
|
||||||
{{ article.metadata.draft ? 'Drafted on' : 'Published on' }}
|
<span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(article.metadata.date) }}
|
||||||
{{ simpleDateFormat(article.metadata.date) }}
|
|
||||||
</div>
|
</div>
|
||||||
<img
|
<img
|
||||||
v-if="article.metadata.thumbnail"
|
v-if="article.metadata.thumbnail"
|
||||||
|
|||||||
@@ -3,15 +3,17 @@ import { ref, onBeforeMount } from 'vue'
|
|||||||
import { listArticles } from '@lib/articles'
|
import { listArticles } from '@lib/articles'
|
||||||
import type { ArticleMetadata } from '@interfaces'
|
import type { ArticleMetadata } from '@interfaces'
|
||||||
import { simpleDateFormat } from '@lib/dates'
|
import { simpleDateFormat } from '@lib/dates'
|
||||||
import { TITLE } from '@lib/meta'
|
import { HOME_COUNT, PROD, PUBLISHED_ON, TITLE } from '@lib/config'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import PageFooter from '@components/PageFooter.vue'
|
||||||
import { stripHTML } from '@/lib/strings'
|
import { stripHTML } from '@/lib/strings'
|
||||||
import NavBar from '@/components/NavBar.vue'
|
import NavBar from '@components/NavBar.vue'
|
||||||
|
|
||||||
const articles = ref<ArticleMetadata[]>([])
|
const articles = ref<ArticleMetadata[]>([])
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
const newArticles = await listArticles()
|
const newArticles = (await listArticles())
|
||||||
|
.filter((metadata) => (!metadata.draft || !PROD) && metadata.path)
|
||||||
|
.slice(0, HOME_COUNT)
|
||||||
articles.value.splice(0, articles.value.length, ...newArticles)
|
articles.value.splice(0, articles.value.length, ...newArticles)
|
||||||
window.document.title = stripHTML(TITLE) + ' — Home'
|
window.document.title = stripHTML(TITLE) + ' — Home'
|
||||||
})
|
})
|
||||||
@@ -21,10 +23,12 @@ onBeforeMount(async () => {
|
|||||||
<main class="home">
|
<main class="home">
|
||||||
<NavBar />
|
<NavBar />
|
||||||
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
<template v-for="(metadata, index) in articles" v-bind:key="index">
|
||||||
<div v-if="!metadata.draft && metadata.path" class="article-item">
|
<div v-if="(!metadata.draft || !PROD) && metadata.path" class="article-item">
|
||||||
<RouterLink :to="metadata.path">
|
<RouterLink :to="metadata.path">
|
||||||
<h2 v-html="metadata.title"></h2>
|
<h2 v-html="metadata.title"></h2>
|
||||||
<span class="article-published">Published on {{ simpleDateFormat(metadata.date) }}</span>
|
<span class="article-published"
|
||||||
|
><span v-html="PUBLISHED_ON"></span> {{ simpleDateFormat(metadata.date) }}</span
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
v-if="metadata.thumbnail"
|
v-if="metadata.thumbnail"
|
||||||
alt="thumbnail"
|
alt="thumbnail"
|
||||||
|
|||||||
@@ -1,18 +1,23 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { TITLE } from '@/lib/meta'
|
import { TITLE } from '@lib/config'
|
||||||
import { stripHTML } from '@/lib/strings'
|
import { stripHTML } from '@lib/strings'
|
||||||
import PageFooter from '@components/PageFooter.vue'
|
import PageFooter from '@components/PageFooter.vue'
|
||||||
import { onBeforeMount } from 'vue'
|
import { onBeforeMount, ref } from 'vue'
|
||||||
|
import NavBar from '@components/NavBar.vue'
|
||||||
|
|
||||||
onBeforeMount(() => {
|
const html = ref<string>('')
|
||||||
window.document.title = stripHTML(TITLE) + ' — Not Found'
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
window.document.title = stripHTML(TITLE)
|
||||||
|
|
||||||
|
html.value = (await import('@articles/not_found.md')).html
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<main>
|
<main class="article">
|
||||||
<NavBar />
|
<NavBar />
|
||||||
<h1>Page not found</h1>
|
<div v-html="html"></div>
|
||||||
<PageFooter />
|
<PageFooter />
|
||||||
</main>
|
</main>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ export default ({ mode }: { mode: string }) => {
|
|||||||
process.env.VITE_APP_COPYRIGHT = articlesConfig['copyright']
|
process.env.VITE_APP_COPYRIGHT = articlesConfig['copyright']
|
||||||
process.env.VITE_APP_RSS_LINK = articlesConfig['rss_link']
|
process.env.VITE_APP_RSS_LINK = articlesConfig['rss_link']
|
||||||
process.env.VITE_APP_BACK_LINK = articlesConfig['back_link']
|
process.env.VITE_APP_BACK_LINK = articlesConfig['back_link']
|
||||||
|
process.env.VITE_APP_HOME_COUNT = articlesConfig['home_count'].toString()
|
||||||
|
process.env.VITE_APP_PUBLISHED_ON = articlesConfig['published_on']
|
||||||
|
|
||||||
return defineConfig({
|
return defineConfig({
|
||||||
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
|
plugins: [vue(), vueDevTools(), mdPlugin({ mode: [Mode.HTML] })],
|
||||||
|
|||||||
Reference in New Issue
Block a user