Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.14.0
v24.12.0
2 changes: 2 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import partytown from '@astrojs/partytown';
import rehypeToc from 'rehype-toc';
import rehypeSlug from 'rehype-slug';
import remarkLinkCard from 'remark-link-card-plus';
import remarkBreaks from 'remark-breaks';
import { remarkMermaidInjector } from './src/plugins/remark/remark-mermaid-injector.mjs';

// https://astro.build/config
Expand All @@ -31,6 +32,7 @@ export default defineConfig({
rehypePlugins: [rehypeSlug, [rehypeToc, { headings: ['h2', 'h3', 'h4'] }]],
remarkPlugins: [
remarkMermaidInjector,
remarkBreaks,
[
remarkLinkCard,
{ cache: false, shortenUrl: true, thumbnailPosition: 'left' },
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "0.0.1",
"private": true,
"engines": {
"node": "22.14.0"
"node": "24.12.0"
},
"scripts": {
"preinstall": "npx only-allow pnpm",
Expand Down Expand Up @@ -48,6 +48,7 @@
"react-dom": "^18.3.1",
"rehype-slug": "^6.0.0",
"rehype-toc": "^3.0.2",
"remark-breaks": "^4.0.0",
"remark-link-card-plus": "^0.7.2",
"satori": "^0.10.13",
"sharp": "^0.33.4",
Expand Down
22 changes: 21 additions & 1 deletion pnpm-lock.yaml

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

93 changes: 92 additions & 1 deletion src/layouts/BlogLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ const authorX = author?.links?.find(l => l.name === 'X')?.id;
<div class="flex flex-wrap gap-1">
{
blog.data.tags.map(tag => {
return <Badge variant="outline">#{tag}</Badge>;
return (
<a href={`/blog/tag/${encodeURIComponent(tag)}`}>
<Badge variant="outline">#{tag}</Badge>
</a>
);
})
}
</div>
Expand Down Expand Up @@ -144,6 +148,54 @@ const authorX = author?.links?.find(l => l.name === 'X')?.id;
/>
</main>
<Footer />
<div id="copy-toast" class="copy-toast">Link is copied.</div>
<script is:inline>
document.addEventListener('DOMContentLoaded', () => {
const toast = document.getElementById('copy-toast');

function showToast() {
if (!toast) return;
toast.style.display = 'block';
toast.style.opacity = '1';
setTimeout(() => {
toast.style.opacity = '0';
setTimeout(() => {
toast.style.display = 'none';
}, 300);
}, 1000);
}

function copyAnchor(el) {
const url = `${location.origin}${location.pathname}#${el.id}`;
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url);
} else {
return;
}
showToast();
}

function attachCopyEvent(el) {
const handler = () => {
copyAnchor(el);
};
if (typeof window.ontouchstart === 'undefined') {
el.addEventListener('click', handler);
} else {
el.addEventListener('touchend', handler);
}
}

document
.querySelectorAll(
'.blog-body h2[id], .blog-body h3[id], .blog-body h4[id]'
)
.forEach(h => {
h.style.cursor = 'pointer';
attachCopyEvent(h);
});
});
</script>
<style is:global lang="scss">
$space: 2rem;
$space-sp: 1.6rem;
Expand Down Expand Up @@ -319,6 +371,27 @@ const authorX = author?.links?.find(l => l.name === 'X')?.id;
background-color: #efefef;
}
}

blockquote {
margin-left: 0;
margin-right: 0;
padding: calc($space-sp * 0.8) calc($space-sp);
border-left: 4px solid #efefef;
background-color: #fafafa;
color: #555;

@media (min-width: 768px) {
padding: calc($space * 0.8) calc($space);
}

> :first-child {
margin-top: 0;
}

> :last-child {
margin-bottom: 0;
}
}
}

.remark-link-card-plus__container {
Expand Down Expand Up @@ -364,6 +437,24 @@ const authorX = author?.links?.find(l => l.name === 'X')?.id;
.remark-link-card-plus__image {
@apply my-0 h-full w-full object-cover;
}
.copy-toast {
display: none;
position: fixed;
right: 50%;
bottom: 2rem;
transform: translateX(50%);
z-index: 99999;
min-width: 120px;
padding: 0.75rem 1.25rem;
background: rgba(30, 41, 59, 0.95);
color: #fff;
border-radius: 0.5rem;
font-size: 0.95rem;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
text-align: center;
pointer-events: none;
transition: opacity 0.3s;
}
</style>
</body>
</html>