diff --git a/app/pages/[slug]/PageClient.tsx b/app/pages/[slug]/PageClient.tsx index 0d8b210..c243d11 100644 --- a/app/pages/[slug]/PageClient.tsx +++ b/app/pages/[slug]/PageClient.tsx @@ -15,6 +15,7 @@ import { } from "lucide-react"; import Link from "next/link"; import React from "react"; +import redirects from "../../../lib/redirects.config"; interface Props { page: Page; @@ -55,7 +56,14 @@ function ApplySpecialClass({ text }: { text: string }) { const linkMatch = link.match(/^\[([^\]]+)\]\(([^)]+)\)$/); if (linkMatch) { parts.push( - + {linkMatch[1]} , ); diff --git a/app/rules/page.tsx b/app/rules/page.tsx index ab21073..8bb948e 100644 --- a/app/rules/page.tsx +++ b/app/rules/page.tsx @@ -3,6 +3,7 @@ import ShinyText from "@/components/bits/ShinyText"; import { fadeInUp, staggerContainer } from "@/lib/animations"; import { motion } from "framer-motion"; +import { useEffect, useState } from "react"; const rules = [ { @@ -39,7 +40,7 @@ const rules = [ number: "06", title: "Format your code like you care", description: - "Triple backticks exist for a reason. Pasting a wall of unformatted code and asking why it's broken is a fast way to get ignored. Wrap it, label the language, and give people enough context to actually help you.", + "Triple backticks exist for a reason. Pasting a wall of unformatted code and asking why it's broken is a fast way to get ignored. Wrap it in code block, label the language, and give people enough context to actually help you.", }, { number: "07", @@ -110,6 +111,16 @@ const rules = [ ]; export default function RulesPage() { + const [activeRule, setActiveRule] = useState(""); + + useEffect(() => { + const hash = window.location.hash; + + if (hash) { + const id = hash.replace("#", ""); + setActiveRule(id); + } + }, []); return (
@@ -239,7 +250,7 @@ export default function RulesPage() { {rules.map((rule, i) => ( {/* Corner brackets */} @@ -303,8 +317,9 @@ export default function RulesPage() { {/* Content */}
-

"} {rule.title} -

+

(); export function LinkPreviewCard({ href, + newTab = true, children, }: { href: string; + newTab?: boolean; children: React.ReactNode; }) { const [hovering, setHovering] = useState(false); @@ -110,7 +112,7 @@ export function LinkPreviewCard({