Compare commits
No commits in common. "fa6c205838e4a504e81e23625f3806931a09396d" and "e3f9b53451d15ef20084b556a56b570770d83831" have entirely different histories.
fa6c205838
...
e3f9b53451
4 changed files with 9 additions and 29 deletions
|
|
@ -1,6 +1,5 @@
|
||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
@import '../node_modules/highlight.js/styles/monokai.min.css';
|
@import '../node_modules/highlight.js/styles/monokai.min.css';
|
||||||
@import '../node_modules/katex/dist/katex.min.css';
|
|
||||||
|
|
||||||
@theme {
|
@theme {
|
||||||
--color-bg: #040404;
|
--color-bg: #040404;
|
||||||
|
|
@ -25,16 +24,6 @@ pre code.hljs {
|
||||||
@apply p-0;
|
@apply p-0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.katex-display {
|
|
||||||
overflow-x: auto;
|
|
||||||
overflow-y: hidden;
|
|
||||||
padding-block-end: 0.25rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.katex-display > .katex > .katex-html > .tag {
|
|
||||||
@apply relative ml-8 lg:absolute lg:right-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
* {
|
||||||
@apply scroll-smooth;
|
@apply scroll-smooth;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { ShareLinks } from '@/components/post/ShareLinks'
|
||||||
import { TableOfContents } from '@/components/post/TableOfContents'
|
import { TableOfContents } from '@/components/post/TableOfContents'
|
||||||
import { getAllPostSlugs, getNextAndPreviousPosts, getPostBySlug } from '@/lib/posts'
|
import { getAllPostSlugs, getNextAndPreviousPosts, getPostBySlug } from '@/lib/posts'
|
||||||
import { slugify } from '@/utils/slug'
|
import { slugify } from '@/utils/slug'
|
||||||
import { Pencil, SendHorizonal } from 'lucide-react'
|
|
||||||
import type { Metadata } from 'next'
|
import type { Metadata } from 'next'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
|
|
@ -44,7 +43,7 @@ export default async function Post({ params }: { params: Promise<{ slug: string
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="flex w-full">
|
<main className="flex w-full">
|
||||||
<article className="max-w-3xl 2xl:max-w-4xl mx-auto px-4 py-8 lg:py-16 min-w-0">
|
<article className="max-w-3xl 2xl:max-w-4xl mx-auto px-4 py-8 lg:py-16">
|
||||||
{meta.category && (
|
{meta.category && (
|
||||||
<Link
|
<Link
|
||||||
href={`/categories/${slugify(meta.category)}`}
|
href={`/categories/${slugify(meta.category)}`}
|
||||||
|
|
@ -54,12 +53,9 @@ export default async function Post({ params }: { params: Promise<{ slug: string
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
<h1 className="text-4xl font-bold mb-4">{meta.title}</h1>
|
<h1 className="text-4xl font-bold mb-4">{meta.title}</h1>
|
||||||
<div className="flex justify-between md:justify-normal items-center gap-2 text-fg-dim mb-4 border-y border-border py-2 px-2 md:px-4 text-sm">
|
<div className="flex items-center gap-2 text-fg-dim mb-4 border-y border-border py-2 px-4 text-sm">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="hidden md:inline">Posted</span>
|
<span>Posted</span>
|
||||||
<span className="md:hidden">
|
|
||||||
<SendHorizonal className="w-3 h-3" />
|
|
||||||
</span>
|
|
||||||
<time
|
<time
|
||||||
dateTime={meta.date}
|
dateTime={meta.date}
|
||||||
title={new Date(meta.date).toLocaleString()}
|
title={new Date(meta.date).toLocaleString()}
|
||||||
|
|
@ -67,19 +63,16 @@ export default async function Post({ params }: { params: Promise<{ slug: string
|
||||||
>
|
>
|
||||||
{new Date(meta.date).toLocaleDateString(undefined, {
|
{new Date(meta.date).toLocaleDateString(undefined, {
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
month: 'short',
|
month: 'long',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
})}
|
})}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
<span className="hidden md:inline">·</span>
|
<span>·</span>
|
||||||
{meta.updated && (
|
{meta.updated && (
|
||||||
<>
|
<>
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="hidden md:inline">Updated</span>
|
<span>Updated</span>
|
||||||
<span className="md:hidden">
|
|
||||||
<Pencil className="w-3 h-3" />
|
|
||||||
</span>
|
|
||||||
<time
|
<time
|
||||||
dateTime={meta.updated}
|
dateTime={meta.updated}
|
||||||
title={new Date(meta.updated).toLocaleString()}
|
title={new Date(meta.updated).toLocaleString()}
|
||||||
|
|
@ -87,12 +80,12 @@ export default async function Post({ params }: { params: Promise<{ slug: string
|
||||||
>
|
>
|
||||||
{new Date(meta.updated).toLocaleDateString(undefined, {
|
{new Date(meta.updated).toLocaleDateString(undefined, {
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
month: 'short',
|
month: 'long',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
})}
|
})}
|
||||||
</time>
|
</time>
|
||||||
</div>
|
</div>
|
||||||
<span className="hidden md:inline">·</span>
|
<span>·</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<span>{meta.readingTimeText}</span>
|
<span>{meta.readingTimeText}</span>
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ export async function getPostBySlug(slug: string) {
|
||||||
.use(rehypeDefinition)
|
.use(rehypeDefinition)
|
||||||
|
|
||||||
if (data.math) {
|
if (data.math) {
|
||||||
processor = processor.use(rehypeKatex)
|
processor = processor.use(rehypeKatex, { output: 'mathml' })
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.mermaid) {
|
if (data.mermaid) {
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,6 @@ export const rehypeMermaidSsg: Plugin<[], Root> = () => async (tree: Root) => {
|
||||||
const svg = await renderMermaidToSvg(chart)
|
const svg = await renderMermaidToSvg(chart)
|
||||||
const svgTree = fromHtmlIsomorphic(svg, { fragment: true })
|
const svgTree = fromHtmlIsomorphic(svg, { fragment: true })
|
||||||
const svgNode = svgTree.children.find((c) => c.type === 'element') as Element | undefined
|
const svgNode = svgTree.children.find((c) => c.type === 'element') as Element | undefined
|
||||||
svgNode?.properties.className?.push('max-w-160', 'mx-auto', 'my-4')
|
|
||||||
if (svgNode?.properties.style) svgNode.properties.style = ''
|
|
||||||
if (svgNode) {
|
if (svgNode) {
|
||||||
;(parent.children as Element[])[index] = svgNode
|
;(parent.children as Element[])[index] = svgNode
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue