Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -253,3 +253,4 @@ $RECYCLE.BIN/

# End of https://www.toptal.com/developers/gitignore/api/osx,windows,linux,nextjs,react,node
cdk.out
.claude/
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"lucide-react": "^0.483.0",
"md5": "^2.3.0",
"mystjs": "^0.0.15",
"next": "15.5.7",
"next": "15.5.9",
"next-themes": "^0.4.4",
"nextjs-toploader": "^3.8.16",
"node-fetch": "^3.3.2",
Expand Down
39 changes: 39 additions & 0 deletions scripts/dev-clean-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
CHECK="✓"
ARROW="→"

echo "${YELLOW}=== Clean Start for Source.coop Development ===${NC}"

# Step 1: Clean up
echo -e "\n${YELLOW}${ARROW} Cleaning up...${NC}"
pkill -f "next dev" > /dev/null 2>&1
docker-compose down > /dev/null 2>&1
rm -rf .next
echo -e "${GREEN}${CHECK} Cleaned up old processes and build cache${NC}"

# Step 2: Start Docker services
echo -e "\n${YELLOW}${ARROW} Starting Docker services (DynamoDB on :8000)...${NC}"
docker-compose up -d
echo -e "${GREEN}${CHECK} Docker services started${NC}"

# Step 3: Wait for services
echo -e "\n${YELLOW}${ARROW} Waiting for services to initialize...${NC}"
sleep 10
echo -e "${GREEN}${CHECK} Services ready${NC}"

# Step 4: Start dev server without AWS profile
echo -e "\n${YELLOW}${ARROW} Starting development server...${NC}"
echo -e "${GREEN}Application will be available at: http://localhost:3000${NC}"
echo -e "${GREEN}DynamoDB Admin UI at: http://localhost:8001${NC}"
echo -e "\n${YELLOW}Press Ctrl+C to stop the development server${NC}\n"

# Unset AWS profile to use local DynamoDB
unset AWS_PROFILE
unset AWS_DEFAULT_PROFILE
npm run dev

26 changes: 26 additions & 0 deletions src/components/features/markdown/HeadingWithPermalink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ReactNode } from "react";
import { Heading } from "@radix-ui/themes";
import { Link2Icon } from "@radix-ui/react-icons";

interface HeadingWithPermalinkProps {
id: string;
level: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
children: ReactNode;
mb?: "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
}

export function HeadingWithPermalink({
id,
level,
children,
mb,
}: HeadingWithPermalinkProps) {
return (
<Heading size={level} mb={mb} id={id} className="heading-with-permalink">
{children}
<a href={`#${id}`} className="permalink-link" aria-label="Permalink">
<Link2Icon />
</a>
</Heading>
);
}
69 changes: 49 additions & 20 deletions src/components/features/markdown/MarkdownViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import remarkGfm from "remark-gfm";
import rehypeRaw from "rehype-raw";
import rehypeSanitize, { defaultSchema } from "rehype-sanitize";
import { Code } from "./codeConfig";
import { HeadingWithPermalink } from "./HeadingWithPermalink";
import "@/styles/MarkdownViewer.css";

interface MarkdownViewerProps {
Expand Down Expand Up @@ -38,47 +39,74 @@ export function MarkdownViewer({ content }: MarkdownViewerProps) {
}

return (
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw, [rehypeSanitize, sanitizeSchema]]}
components={{
<div className="markdown-viewer">
<ReactMarkdown
remarkPlugins={[remarkGfm]}
rehypePlugins={[rehypeRaw, [rehypeSanitize, sanitizeSchema]]}
components={{
h1: ({ children }) => (
<Heading size="8" mb="4" id={generateHeadingId(String(children))}>
<HeadingWithPermalink
id={generateHeadingId(String(children))}
level="8"
mb="4"
>
{children}
</Heading>
</HeadingWithPermalink>
),
h2: ({ children }) => (
<Heading size="7" mb="3" id={generateHeadingId(String(children))}>
<HeadingWithPermalink
id={generateHeadingId(String(children))}
level="7"
mb="3"
>
{children}
</Heading>
</HeadingWithPermalink>
),
h3: ({ children }) => (
<Heading size="6" mb="2" id={generateHeadingId(String(children))}>
<HeadingWithPermalink
id={generateHeadingId(String(children))}
level="6"
mb="2"
>
{children}
</Heading>
</HeadingWithPermalink>
),
h4: ({ children }) => (
<Heading size="5" mb="2" id={generateHeadingId(String(children))}>
<HeadingWithPermalink
id={generateHeadingId(String(children))}
level="5"
mb="2"
>
{children}
</Heading>
</HeadingWithPermalink>
),
h5: ({ children }) => (
<Heading size="4" mb="2" id={generateHeadingId(String(children))}>
<HeadingWithPermalink
id={generateHeadingId(String(children))}
level="4"
mb="2"
>
{children}
</Heading>
</HeadingWithPermalink>
),
h6: ({ children }) => (
<Heading size="3" mb="2" id={generateHeadingId(String(children))}>
<HeadingWithPermalink
id={generateHeadingId(String(children))}
level="3"
mb="2"
>
{children}
</Heading>
</HeadingWithPermalink>
),
p: ({ children }) => (
<Text as="p" mb="3">
{children}
</Text>
),
a: ({ href, children }) => (
<RadixLink href={href}>{children}</RadixLink>
<RadixLink href={href} underline="always">
{children}
</RadixLink>
),
table: ({ children }) => (
<Table.Root mb="3" variant="surface">
Expand Down Expand Up @@ -106,8 +134,9 @@ export function MarkdownViewer({ content }: MarkdownViewerProps) {
return <Code lang={lang}>{codeContent}</Code>;
},
}}
>
{content}
</ReactMarkdown>
>
{content}
</ReactMarkdown>
</div>
);
}
35 changes: 26 additions & 9 deletions src/styles/MarkdownViewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ code.inline-code {
margin: 1em 0;
}

/* Links */
.markdown-viewer a {
color: var(--blue-9);
text-decoration: none;
}

.markdown-viewer a:hover {
text-decoration: underline;
}

/* Styles for MyST admonitions */
.admonition {
Expand Down Expand Up @@ -135,3 +126,29 @@ code.inline-code {
:root[class~="dark"] .admonition.important {
background-color: var(--purple-12);
}

/* Permalink styles */
.heading-with-permalink {
display: inline-flex;
align-items: center;
gap: 0.5rem;
}

.permalink-link {
display: none;
color: var(--gray-9);
text-decoration: none;
}

.heading-with-permalink:hover .permalink-link {
display: inline-flex;
}

.permalink-link:hover {
color: var(--blue-9);
}

.permalink-link svg {
width: 0.85em;
height: 0.85em;
}