Skip to content

Commit 7f9d8e0

Browse files
committed
feat: overhaul markdown rendering
1 parent ee853f2 commit 7f9d8e0

19 files changed

Lines changed: 269 additions & 65 deletions

astro.config.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,27 @@ import path from 'path'
33
import vue from '@astrojs/vue'
44
import mdx from '@astrojs/mdx'
55
import devtoolsJson from 'vite-plugin-devtools-json'
6+
import type { Extension } from 'micromark-util-types'
7+
import { micromarkExtensions } from '@/lib/markdown'
8+
import remarkGfm from 'remark-gfm'
69

710
export default defineConfig({
8-
integrations: [vue(), mdx()],
11+
integrations: [
12+
vue(),
13+
mdx({
14+
remarkPlugins: [
15+
remarkGfm,
16+
(_tree, file) => {
17+
const data = file.data as {
18+
micromarkExtensions?: Extension[]
19+
}
20+
21+
data.micromarkExtensions ??= []
22+
data.micromarkExtensions.push(...micromarkExtensions)
23+
}
24+
]
25+
})
26+
],
927
i18n: {
1028
locales: ['en', 'zh'],
1129
defaultLocale: 'en',

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
"decamelcase-keys": "^1.1.1",
3232
"esbuild": "^0.25.12",
3333
"lodash": "^4.17.21",
34-
"marked": "^16.4.2",
34+
"micromark-extension-cjk-friendly": "^1.2.3",
35+
"micromark-extension-cjk-friendly-gfm-strikethrough": "^1.2.3",
36+
"remark-gfm": "^4.0.1",
37+
"remark-mdx": "^3.1.1",
3538
"serve": "^14.2.5",
3639
"tsx": "^4.20.6",
3740
"vite-plugin-devtools-json": "^0.4.1",

pnpm-lock.yaml

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

src/components/Footer.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import Logo from '@/assets/logo.svg'
33
import LanguageSelector from './navigation/LanguageSelector.astro'
44
import { commitHash, commitHashShort } from '@/lib/commit-hash'
55
import { t } from 'astro-i18n'
6-
import { marked } from 'marked'
6+
77
import { getCopyrightSpan } from '@/lib/copyright'
8+
import { renderInline } from '@/lib/markdown'
89
910
const props = Astro.props
1011
---
@@ -16,23 +17,23 @@ const props = Astro.props
1617
<div class="content">
1718
<p>&copy; {getCopyrightSpan(2024)}&emsp;結束ティータイム</p>
1819
<p
19-
set:html={marked.parseInline(
20+
set:html={renderInline(
2021
t('component.footer.content', undefined, { locale: Astro.currentLocale })
2122
)}
2223
/>
2324
</div>
2425
<div class="footnote">
2526
<p>
2627
<span
27-
set:html={marked.parseInline(
28+
set:html={renderInline(
2829
t('component.footer.footnote.pre', undefined, { locale: Astro.currentLocale })
2930
)}
3031
/>
3132
<span class="select-wrapper">
3233
<LanguageSelector />
3334
</span>
3435
<span
35-
set:html={marked.parseInline(
36+
set:html={renderInline(
3637
t('component.footer.footnote.post', undefined, { locale: Astro.currentLocale })
3738
)}
3839
/>

src/components/Overview.astro

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,67 @@ const props = Astro.props
66

77
<div {...props}>
88
<slot name="title" />
9-
<TicketCard class="description-card" borderThickness="1px" cornerSize="3.25em">
9+
<div class="spacing" data-spacing="1"></div>
10+
<TicketCard class="card description-card" borderThickness="1px" cornerSize="3.25em">
1011
<slot name="description" />
1112
</TicketCard>
12-
<TicketCard class="portfolio-card" borderThickness="1px" cornerSize="3.25em">
13+
<TicketCard class="card portfolio-card" borderThickness="1px" cornerSize="3.25em">
1314
<slot name="portfolio" />
1415
</TicketCard>
1516
</div>
1617

1718
<style lang="scss">
19+
@use '@/styles/mixins' as *;
20+
21+
.spacing {
22+
&[data-spacing='1'] {
23+
height: 2.5rem;
24+
25+
@include layout(desktop) {
26+
height: 0;
27+
}
28+
}
29+
}
30+
31+
.card {
32+
padding: 1.5em 1em;
33+
34+
--hr-spacing: 2em;
35+
--hr-padding: 1em;
36+
37+
@include layout(compact) {
38+
padding: 2em 1px;
39+
margin: 0 -1px;
40+
41+
--hr-spacing: 2em;
42+
--hr-padding: 0;
43+
44+
&:last-child {
45+
mask: linear-gradient(to bottom, black calc(100% - 2em), transparent calc(100% - 2em));
46+
}
47+
}
48+
49+
@include layout(desktop) {
50+
padding: 2em;
51+
margin: 4.25em 2.5em;
52+
53+
--hr-spacing: 3em;
54+
--hr-padding: 2em;
55+
}
56+
}
57+
1858
.description-card {
19-
margin: 4.25em 2.5em;
20-
rotate: -3.27deg;
21-
transform: translateX(-2.1%);
59+
@include layout(desktop) {
60+
rotate: -3.27deg;
61+
transform: translateX(-3.8%);
62+
}
2263
}
2364

2465
.portfolio-card {
25-
margin: 4.25em 2.5em;
26-
rotate: 1.97deg;
27-
transform: translateX(3.2%);
66+
@include layout(desktop) {
67+
rotate: 2.15deg;
68+
transform: translateX(4.2%);
69+
}
2870
}
2971

3072
.links {

src/components/TicketCard.astro

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ const { borderThickness = '1px', cornerSize = '3.25em', ...props } = Astro.props
1414
style={`--border-thickness: ${borderThickness}; --corner-size: ${cornerSize}`}
1515
{...props}
1616
>
17-
<div class="content"><slot /></div>
17+
<slot />
18+
<div class="border"></div>
1819
<div class="corner" data-corner="lt"></div>
1920
<div class="corner" data-corner="rt"></div>
2021
<div class="corner" data-corner="rb"></div>
@@ -25,14 +26,23 @@ const { borderThickness = '1px', cornerSize = '3.25em', ...props } = Astro.props
2526
.card {
2627
position: relative;
2728
overflow: hidden;
29+
min-width: calc(var(--corner-size) * 2);
30+
min-height: calc(var(--corner-size) * 2);
31+
32+
& > .border {
33+
position: absolute;
34+
width: 100%;
35+
height: 100%;
36+
top: 0;
37+
left: 0;
2838

29-
& > .content {
30-
padding: 2em;
3139
border-left: var(--border-thickness) solid var(--color-border);
3240
border-right: var(--border-thickness) solid var(--color-border);
3341
border-top: var(--border-thickness) dashed var(--color-border);
3442
border-bottom: var(--border-thickness) dashed var(--color-border);
3543
box-sizing: border-box;
44+
45+
pointer-events: none;
3646
}
3747

3848
& > .corner {
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
**Kessoku Tea Time (結束ティータイム)[^name]** is a group of cute developers.
2-
3-
[^name]: The name Kessoku Tea Time (結束ティータイム) is a combination of Kessoku (結束), which derives from the band [Kessoku Band (結束バンド)](https://bocchi-the-rock.fandom.com/wiki/Kessoku_Band) from the bangumi [Bocchi the Rock!](https://bocchi.rocks/), and Tea Time (ティータイム), which derives from the band [Ho-kago Tea Time (放課後ティータイム)](https://k-on.fandom.com/wiki/Ho-kago_Tea_Time) from the bangumi [K-ON! (けいおん!)](https://www.tbs.co.jp/anime/k-on/).
1+
**Kessoku Tea Time (結束ティータイム)** is a group of cute developers.
42

53
### What We Do&ensp;<img style="display: inline-block;height: 1.5em;margin-top: auto;margin-bottom: -0.25em" alt="image" src="https://github.com/KessokuTeaTime/.github/assets/68179735/4787c537-e7f7-4046-9d39-189df6cb7ed2" />
64

7-
- Make [Minecraft](https://minecraft.net) mods on multiple mod loaders
5+
- Make **[Minecraft](https://minecraft.net)** mods on multiple mod loaders
6+
- Design subtle websites and cute graphics (like this one!)
7+
- Build **open source** developer tools and libraries
88

99
### What We Can't Do&ensp;<img style="display: inline-block;height: 1.5em;margin-top: auto;margin-bottom: -0.25em" alt="image" src="https://github.com/KessokuTeaTime/.github/assets/68179735/c3360830-7261-4b0f-a9a9-b466f1c6fb2c" />
1010

1111
- Sing
1212
- Become the most popular band in Shimokitazawa
13+
14+
---
15+
16+
<sub>
17+
The name **Kessoku Tea Time (結束ティータイム)** is a combination of **Kessoku (結束),** which
18+
derives from the band **[Kessoku Band
19+
(結束バンド)](https://bocchi-the-rock.fandom.com/wiki/Kessoku_Band)** from the bangumi **[Bocchi
20+
the Rock!](https://bocchi.rocks/),** and **Tea Time (ティータイム),** which derives from the band
21+
**[Ho-kago Tea Time (放課後ティータイム)](https://k-on.fandom.com/wiki/Ho-kago_Tea_Time)** from
22+
the bangumi **[K-ON! (けいおん!)](https://www.tbs.co.jp/anime/k-on/).**
23+
</sub>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# 結束ティータイム<span style="color: var(--tint-mute)"> ~ A cybershelter with tea, music and love.</span>
1+
# 結束ティータイム <span style="color: var(--tint-mute)"><span style="white-space: nowrap">~ A cybershelter</span> with tea, music <span style="white-space: nowrap">and love.</span></span>
Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
<b>结束 TEA TIME(結束ティータイム)[^name]</b>是一群可爱的开发者。
2-
3-
[^name]: 结束 TEA TIME(結束ティータイム)是由[结束乐队(結束バンド)](https://bocchi-the-rock.fandom.com/wiki/Kessoku_Band)的结束(来自番剧[孤独摇滚](https://bocchi.rocks/))和[放学后 TEA TIME(放課後ティータイム)](https://k-on.fandom.com/wiki/Ho-kago_Tea_Time)的TEA TIME(ティータイム)(来自番剧[轻音少女 K-ON!](https://www.tbs.co.jp/anime/k-on/))组合而成。
1+
**结束 TEA TIME(結束ティータイム)**{'\u200B'}是一群可爱的开发者。
42

53
### 我们在做的&ensp;<img style="display: inline-block;height: 1.5em;margin-top: auto;margin-bottom: -0.25em" alt="image" src="https://github.com/KessokuTeaTime/.github/assets/68179735/4787c537-e7f7-4046-9d39-189df6cb7ed2" />
64

7-
-[Minecraft](https://minecraft.net)制作跨加载器的模组
5+
-{'\u200B'}**[Minecraft](https://minecraft.net)**{'\u200B'}制作跨加载器的模组
6+
- 设计好康的网站和阔耐的图片(这个就是!)
7+
- 构建**开源**的工具和库
88

99
### 我们做不到&ensp;<img style="display: inline-block;height: 1.5em;margin-top: auto;margin-bottom: -0.25em" alt="image" src="https://github.com/KessokuTeaTime/.github/assets/68179735/c3360830-7261-4b0f-a9a9-b466f1c6fb2c" />
1010

1111
- 唱歌
1212
- 成为下北泽最受欢迎的乐队
13+
14+
---
15+
16+
<sub>
17+
**结束 TEA TIME(結束ティータイム)**{'\u200B'}是由{'\u200B'}
18+
**[结束乐队(結束バンド)](https://bocchi-the-rock.fandom.com/wiki/Kessoku_Band)**{'\u200B'}
19+
{'\u200B'}**结束(来自番剧[孤独摇滚](https://bocchi.rocks/)**{'\u200B'}{'\u200B'}**[放学后 TEA
20+
TIME(放課後ティータイム)](https://k-on.fandom.com/wiki/Ho-kago_Tea_Time)**{'\u200B'}{'\u200B'}
21+
**TEA TIME(ティータイム)(来自番剧[轻音少女 K-ON!](https://www.tbs.co.jp/anime/k-on/)**
22+
{'\u200B'}组合而成的名称。
23+
</sub>

src/components/games/wordle/WordleDatePicker.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
22
import { WordleDate, WordlePartialDate, type Month } from '@/lib/wordle'
3+
import { renderInline } from '@/lib/markdown'
34
import { t } from 'astro-i18n'
45
import { computed, onMounted, ref, watchEffect } from 'vue'
5-
import { marked } from 'marked'
66
import { Icon } from '@iconify/vue'
77
88
const props = defineProps<{
@@ -53,7 +53,7 @@ function onPlay() {
5353
<p v-if="!isOpened">
5454
<span
5555
v-html="
56-
marked.parseInline(
56+
renderInline(
5757
t(
5858
'page.games.wordle.date_picker.description',
5959
{ date: date.toDate().toLocaleDateString() },
@@ -66,7 +66,7 @@ function onPlay() {
6666
<button
6767
class="underline"
6868
v-html="
69-
marked.parseInline(t('page.games.wordle.date_picker.play_another', undefined, { locale }))
69+
renderInline(t('page.games.wordle.date_picker.play_another', undefined, { locale }))
7070
"
7171
@click="isOpened = true"
7272
/>

0 commit comments

Comments
 (0)