diff --git a/index.ts b/index.ts index fd2a350..e556774 100644 --- a/index.ts +++ b/index.ts @@ -1,15 +1,16 @@ import { readdir } from "node:fs/promises"; import { YAML } from "bun"; import metadata from "./metadata.json"; -import templateRaw from "./template.html" with { type: "text" }; +import templateRaw from "./templates/post.html" with { type: "text" }; const templateStr = templateRaw as unknown as string; const template = templateStr + .replaceAll("[[SITE]]", metadata.title) .replaceAll("[[NAME]]", metadata.name) + .replaceAll("[[TIMEZONE]]", metadata.timezone) .replaceAll("[[YEAR]]", new Date().getFullYear().toString()); const posts = await readdir("./posts"); const defaultFrontmatter = { - thumb: "", title: "Untitled", desc: "", date: "0000-00-00", // YYYY-MM-DD @@ -49,7 +50,6 @@ posts.forEach(async (post) => { .replaceAll("[[DATE]]", frontmatter.date.toDateString()) .replaceAll("[[REVISIONS]]", `https://git.satr14.my.id/satr14/ssg.md/commits/branch/main/posts/${post}`) .replaceAll("[[DESC]]", frontmatter.desc) - .replaceAll("[[THUMB]]", frontmatter.thumb) .replace("[[CONTENT]]", html); await Bun.write(`./dist/posts/${post.replace(".md", ".html")}`, render); diff --git a/posts/test.md b/posts/test.md index 2374e95..7fe722e 100644 --- a/posts/test.md +++ b/posts/test.md @@ -1,4 +1,3 @@ -thumb: https://picsum.photos/id/237/200/300 title: Comprehensive Markdown & GFM Syntax Reference desc: A detailed guide to Markdown and GitHub Flavored Markdown (GFM) syntax, covering text formatting, lists, tables, code blocks, links, and footnotes. date: 2026-05-27 @@ -153,11 +152,3 @@ echo "${FILE%/*}" # dirname * **Standard Link:** [Search Engine](https://www.google.com) * **Link with Tooltip:** [GitHub](https://github.com "Go to GitHub") * **Autolink (GFM):** https://nixos.org - ---- - -## 6. Footnotes (GFM) - -You can reference a footnote at the end of a sentence[^1]. - -[^1]: This is the text of the footnote, which typically renders at the bottom of the document. \ No newline at end of file diff --git a/style.css b/style.css index c903032..3499a84 100644 --- a/style.css +++ b/style.css @@ -4,7 +4,7 @@ @import "@catppuccin/tailwindcss/mocha.css"; @theme { --font-custom: "Lora", serif; } -body { @apply bg-ctp-base text-ctp-text; } +body { @apply bg-ctp-crust text-ctp-text; } h1 { @apply text-3xl; } h2 { @apply text-2xl; } @@ -31,5 +31,75 @@ table th, table td { @apply border border-ctp-surface1 px-4 py-2; } table th { @apply bg-ctp-surface0 font-semibold; } blockquote { @apply border-l-4 border-ctp-surface1 pl-4 italic my-4; } -code { @apply bg-ctp-surface0 text-ctp-text rounded px-1; } -pre { @apply bg-ctp-surface0 text-ctp-text rounded p-4 overflow-x-auto; } +code { @apply text-ctp-text rounded px-1; } +pre { @apply bg-ctp-base text-ctp-text rounded p-4 overflow-x-auto; } + +/*pre code.hljs { + display: block; + overflow-x: auto; +} +.hljs-comment { + color: #697070; +} +.hljs-punctuation, +.hljs-tag { + color: #444a; +} +.hljs-tag .hljs-attr, +.hljs-tag .hljs-name { + color: #444; +} +.hljs-attribute, +.hljs-doctag, +.hljs-keyword, +.hljs-meta .hljs-keyword, +.hljs-name, +.hljs-selector-tag { + font-weight: 700; +} +.hljs-deletion, +.hljs-number, +.hljs-quote, +.hljs-selector-class, +.hljs-selector-id, +.hljs-string, +.hljs-template-tag, +.hljs-type { + color: #800; +} +.hljs-section, +.hljs-title { + color: #800; + font-weight: 700; +} +.hljs-link, +.hljs-operator, +.hljs-regexp, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-symbol, +.hljs-template-variable, +.hljs-variable { + color: #ab5656; +} +.hljs-literal { + color: #695; +} +.hljs-addition, +.hljs-built_in, +.hljs-bullet, +.hljs-code { + color: #397300; +} +.hljs-meta { + color: #1f7199; +} +.hljs-meta .hljs-string { + color: #38a; +} +.hljs-emphasis { + font-style: italic; +} +.hljs-strong { + font-weight: 700; +}*/ diff --git a/template.html b/template.html deleted file mode 100644 index 5658196..0000000 --- a/template.html +++ /dev/null @@ -1,34 +0,0 @@ - - -
- - - -