Skip to content

Commit 5a69475

Browse files
committed
Added rehypeSlug and rehypeAutolinkHeadings, removed dead code
1 parent ffbf320 commit 5a69475

6 files changed

Lines changed: 96 additions & 22 deletions

File tree

astro.config.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@
22
import { defineConfig } from 'astro/config';
33
import tailwindcss from '@tailwindcss/vite';
44
import mdx from '@astrojs/mdx';
5+
import rehypeSlug from 'rehype-slug';
6+
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
57

68
export default defineConfig({
79
site: 'https://beparano.id',
810
output: 'static',
11+
markdown: {
12+
rehypePlugins: [
13+
rehypeSlug,
14+
[rehypeAutolinkHeadings, {
15+
behavior: 'append',
16+
properties: { class: 'heading-anchor', ariaHidden: 'true', tabIndex: -1 },
17+
content: { type: 'text', value: '#' },
18+
}],
19+
],
20+
},
921
vite: {
1022
plugins: [tailwindcss()],
1123
},

package-lock.json

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"@tailwindcss/typography": "^0.5.19",
1717
"@tailwindcss/vite": "^4.2.4",
1818
"astro": "^6.1.8",
19+
"rehype-autolink-headings": "^7.1.0",
20+
"rehype-slug": "^6.0.0",
1921
"tailwindcss": "^4.2.4"
2022
}
2123
}

public/images/placeholder.svg

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/pages/index.astro

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,17 @@ const formattedDate = (date: Date) =>
1313

1414
<Base>
1515
<section class="mb-16">
16-
<!-- Avatar left -->
1716
<div class="flex items-center gap-5 mb-6">
1817
<img
1918
src="/images/avatar.JPEG"
2019
alt="Ryodari"
2120
class="w-16 h-16 rounded-sm object-cover"
2221
/>
23-
<div>
24-
<p class="text-ink-secondary text-sm font-mono mb-0.5">Hi, I'm</p>
25-
<h1 class="text-3xl font-semibold tracking-tight">Ryodari</h1>
26-
</div>
22+
<div>
23+
<p class="text-ink-secondary text-sm font-mono mb-0.5">Hi, I'm</p>
24+
<h1 class="text-3xl font-semibold tracking-tight">Ryodari</h1>
25+
</div>
2726
</div>
28-
<!-- Hero Avatar -->
29-
<!--
30-
<div>
31-
<img
32-
src="/images/avatar.JPEG"
33-
alt="Ryodari"
34-
class="w-full h-72 object-cover rounded-sm mb-8"
35-
/>
36-
<p class="text-ink-secondary text-sm font-mono mb-1">Hi, I'm</p>
37-
<h1 class="text-3xl font-semibold tracking-tight mb-4">Ryodari</h1>
38-
</div>-->
3927
<p class="text-ink-tertiary text-sm font-mono mb-6">Berlin, Germany</p>
4028
<p class="text-ink-secondary leading-relaxed max-w-prose">
4129
Applied Computer Science @ HTW Berlin. Interested in decentralized systems, wireless networks, and mobile. Also writes about books and good food.

src/styles/global.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
::selection {
5353
background-color: var(--color-surface-strong);
5454
}
55+
5556
}
5657

5758
/* ── Prose (Blog content) ─────────────────────────────────── */
@@ -98,4 +99,18 @@
9899
border: 1px solid var(--color-border);
99100
border-radius: 6px;
100101
}
102+
103+
/* Heading anchor links */
104+
.heading-anchor {
105+
text-decoration: none !important;
106+
opacity: 0;
107+
color: var(--color-ink-tertiary);
108+
font-weight: 400;
109+
margin-left: 0.1em;
110+
transition: opacity 150ms ease;
111+
}
112+
113+
:is(h1, h2, h3, h4, h5, h6):hover .heading-anchor {
114+
opacity: 1;
115+
}
101116
}

0 commit comments

Comments
 (0)