diff --git a/package.json b/package.json index 64fdd7d..36c68cd 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "start": "waku start" }, "dependencies": { + "@sindresorhus/slugify": "^2.2.1", "next-mdx-remote": "^5.0.0", "prettier": "^3.3.3", "react": "19.0.0-rc-5c56b873-20241107", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 18a580f..f2f9d41 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: dependencies: + '@sindresorhus/slugify': + specifier: ^2.2.1 + version: 2.2.1 next-mdx-remote: specifier: ^5.0.0 version: 5.0.0(@types/react@18.3.12)(acorn@8.14.0)(react@19.0.0-rc-5c56b873-20241107) @@ -440,6 +443,14 @@ packages: '@shikijs/vscode-textmate@9.3.0': resolution: {integrity: sha512-jn7/7ky30idSkd/O5yDBfAnVt+JJpepofP/POZ1iMOxK59cOfqIgg/Dj0eFsjOTMw+4ycJN0uhZH/Eb0bs/EUA==} + '@sindresorhus/slugify@2.2.1': + resolution: {integrity: sha512-MkngSCRZ8JdSOCHRaYd+D01XhvU3Hjy6MGl06zhOk614hp9EOAp5gIkBeQg7wtmxpitU6eAL4kdiRMcJa2dlrw==} + engines: {node: '>=12'} + + '@sindresorhus/transliterate@1.6.0': + resolution: {integrity: sha512-doH1gimEu3A46VX6aVxpHTeHrytJAG6HgdxntYnCFiIFHEM/ZGpG8KiZGBChchjQmG0XFIBL552kBTjVcMZXwQ==} + engines: {node: '>=12'} + '@swc/core-darwin-arm64@1.9.1': resolution: {integrity: sha512-2/ncHSCdAh5OHem1fMITrWEzzl97OdMK1PHc9CkxSJnphLjRubfxB5sbc5tDhcO68a5tVy+DxwaBgDec3PXnOg==} engines: {node: '>=10'} @@ -858,6 +869,10 @@ packages: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} + escape-string-regexp@5.0.0: + resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} + engines: {node: '>=12'} + eslint-scope@5.1.1: resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} engines: {node: '>=8.0.0'} @@ -2092,6 +2107,15 @@ snapshots: '@shikijs/vscode-textmate@9.3.0': {} + '@sindresorhus/slugify@2.2.1': + dependencies: + '@sindresorhus/transliterate': 1.6.0 + escape-string-regexp: 5.0.0 + + '@sindresorhus/transliterate@1.6.0': + dependencies: + escape-string-regexp: 5.0.0 + '@swc/core-darwin-arm64@1.9.1': optional: true @@ -2531,6 +2555,8 @@ snapshots: escalade@3.2.0: {} + escape-string-regexp@5.0.0: {} + eslint-scope@5.1.1: dependencies: esrecurse: 4.3.0 diff --git a/posts/first-draft.mdx b/posts/first-draft.mdx index 8ba5872..8dc5fe0 100644 --- a/posts/first-draft.mdx +++ b/posts/first-draft.mdx @@ -3,4 +3,7 @@ slug: first-draft title: A Draft description: hi date: "2024-11-30" +draft: true --- + +> A really long quote diff --git a/src/components/mdx.tsx b/src/components/mdx.tsx index 9010608..4392b60 100644 --- a/src/components/mdx.tsx +++ b/src/components/mdx.tsx @@ -1,114 +1,50 @@ -// import { Link } from 'waku'; +import { Link } from "waku"; import { Code } from "./code"; -// import { getAnchor } from '../utils'; +import { getAnchor } from "../utils"; export const components = { - // h2: ({ children, ...rest }: any) => { - // const id = getAnchor(children); + h2: ({ children, ...rest }: any) => { + const id = getAnchor(children); - // return ( - //

- // {children} - //

- // ); - // }, - // h3: ({ children, ...rest }: any) => { - // const id = getAnchor(children); + return ( +

+ {children} +

+ ); + }, + h3: ({ children, ...rest }: any) => { + const id = getAnchor(children); - // return ( - //

- // {children} - //

- // ); - // }, - // h4: ({ children, ...rest }: any) => { - // const id = getAnchor(children); + return ( +

+ {children} +

+ ); + }, + h4: ({ children, ...rest }: any) => { + const id = getAnchor(children); - // return ( - //

- // {children} - //

- // ); - // }, - // p: ({ children, ...rest }: any) => { - // return ( - //

- // {children} - //

- // ); - // }, - // strong: ({ children, ...rest }: any) => { - // return ( - // - // {children} - // - // ); - // }, - // em: ({ children, ...rest }: any) => { - // return ( - // - // {children} - // - // ); - // }, - // a: ({ href, children, ...rest }: any) => { - // const classNames = - // 'text-white/80 underline decoration-white/60 decoration-1 transition-colors duration-300 ease-in-out hover:text-white'; + return ( +

+ {children} +

+ ); + }, + a: ({ href, children, ...rest }: any) => { + if (href.startsWith("/")) { + + {children} + ; + } - // if (href.startsWith('/')) { - // - // {children} - // ; - // } + return ( + + {children} + + ); + }, - // return ( - // - // {children} - // - // ); - // }, - // ul: ({ children, ...rest }: any) => { - // return ( - // - // ); - // }, - // code: ({ children, ...rest }: any) => { - // return ( - // - // {children} - // - // ); - // }, pre: ({ children, ...rest }: any) => { return ( ); }, - // blockquote: ({ children, ...rest }: any) => { - // return ( - //
- //
- //
- // - // - // - //
- // Note - //
- //
- //
- // {children} - //
- //
- //
- // ); - // }, }; diff --git a/src/page-components/layout.tsx b/src/page-components/layout.tsx index 9e17a29..458942a 100644 --- a/src/page-components/layout.tsx +++ b/src/page-components/layout.tsx @@ -14,7 +14,7 @@ export async function RootLayout({ children }: RootLayoutProps) {
-
+
{children}