Skip to content

Commit 1863cfd

Browse files
committed
Replace highlight to shiki
1 parent 4981879 commit 1863cfd

File tree

13 files changed

+20
-498
lines changed

13 files changed

+20
-498
lines changed

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"remark-rehype": "https://esm.sh/[email protected]",
2929
"rehype-raw": "https://esm.sh/[email protected]",
3030
"rehype-stringify": "https://esm.sh/[email protected]",
31-
"rehype-highlight": "https://esm.sh/[email protected]",
3231
"rehype-slug": "https://esm.sh/[email protected]",
3332
"rehype-autolink-headings": "https://esm.sh/[email protected]",
33+
"@shikijs/rehype": "https://esm.sh/@shikijs/[email protected]",
3434
"remark-gfm": "https://esm.sh/[email protected]",
3535
"yaml": "https://deno.land/[email protected]/yaml/mod.ts",
3636
"Command": "https://deno.land/x/[email protected]/command/mod.ts",

main.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ function getArchive(title, iters) {
6161
(acc, { date, summary }) => {
6262
const place = `/./posts/${handleUTC(date)}/`
6363
return acc +
64-
`<p><a class="decoration-line" href=${place} target="_blank"> ${summary} ··· ${
65-
convertToUSA(date)
64+
`<p><a class="decoration-line" href=${place} target="_blank"> ${summary} ··· ${convertToUSA(date)
6665
}</a></p>`
6766
},
6867
'',
@@ -180,10 +179,9 @@ async function Others() {
180179
const sitemap = new URL('./sitemap.xml', dist)
181180
const itemsSitemap = `<?xml version="1.0" encoding="UTF-8"?>
182181
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
183-
${
184-
metaData.reduce((acc, { date }) =>
185-
`${acc}<url><loc>${website}posts/${handleUTC(date)}/</loc></url>`, '')
186-
}
182+
${metaData.reduce((acc, { date }) =>
183+
`${acc}<url><loc>${website}posts/${handleUTC(date)}/</loc></url>`, '')
184+
}
187185
</urlset>`
188186

189187
// robots
@@ -243,7 +241,7 @@ async function Home() {
243241
? new URL('./index.html', dist)
244242
: new URL(`${cur}/index.html`, homeDest)
245243

246-
await Deno.writeTextFile(url,home)
244+
await Deno.writeTextFile(url, home)
247245
}
248246
}
249247
}
@@ -286,28 +284,17 @@ async function About() {
286284

287285
const [, md] = parseYaml(about)
288286
const content = await markdown(md)
289-
const generated = `${head}${header}${
290-
templateArticle({ title: '关于我', content })
291-
}${footer}`
287+
const generated = `${head}${header}${templateArticle({ title: '关于我', content })
288+
}${footer}`
292289
await Deno.writeTextFile(__dist_about, generated)
293290
}
294291

295-
async function Friends() {
296-
const __dist_friends = new URL('./friends/index.html', dist)
297-
if (!await exists(__dist_friends)) await ensureFile(__dist_friends)
298-
const __src_friends = new URL('./friends/index.html', src)
299-
let friends = await Deno.readTextFile(__src_friends)
300-
friends = replaceBody(friends, header, footer, randomNumber)
301-
302-
await Deno.writeTextFile(__dist_friends, friends)
303-
}
304-
305292
async function main() {
306293
if (existsSync(new URL(dist))) {
307294
Deno.removeSync(new URL(dist), { recursive: true })
308295
}
309296
await handlePosts()
310-
Promise.all([Home(), Archive(), Tags(), Others(), About(), Friends()])
297+
Promise.all([Home(), Archive(), Tags(), Others(), About()])
311298
}
312299

313300
// Handle the http server

public/css/markdown.css

Lines changed: 1 addition & 182 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ blockquote {
4444

4545
pre {
4646
overflow: auto;
47-
background-color: rgba(72, 69, 138);
47+
/* background-color: rgba(72, 69, 138); */
4848
padding: 1.5rem 1.2rem;
4949
border-radius: 0.25rem;
5050
min-height: 2rem;
@@ -78,187 +78,6 @@ p>img:only-child {
7878
margin: 0 auto;
7979
}
8080

81-
code.hl {
82-
span.hl-comment {
83-
color: rgb(179, 98, 255);
84-
}
85-
}
86-
87-
code.language-json {
88-
span.hl-punctuation {
89-
color: rgb(255, 215, 2);
90-
}
91-
92-
span.hl-attr {
93-
color: rgb(255, 215, 2);
94-
}
95-
96-
span.hl-string {
97-
color: rgb(146, 252, 121);
98-
}
99-
100-
span.hl-literal {
101-
color: rgb(255, 97, 140);
102-
}
103-
}
104-
105-
/* code fragment */
106-
code.language-ts,
107-
code.language-js,
108-
span.javascript {
109-
span.hl-keyword {
110-
color: rgb(255, 158, 0);
111-
}
112-
113-
span.hl-attr,
114-
span.hl-title,
115-
span.hl-property {
116-
color: rgb(254, 213, 5);
117-
}
118-
119-
span.hl-params {
120-
color: rgb(116, 180, 193);
121-
}
122-
123-
span.hl-string,
124-
span.hl-params span.hl-built_in {
125-
color: rgb(128, 255, 187);
126-
}
127-
128-
span.hl-variable {
129-
color: rgb(157, 255, 255);
130-
}
131-
132-
span.hl-number,
133-
span.hl-boolean {
134-
color: rgb(255, 97, 140);
135-
}
136-
}
137-
138-
code.language-html {
139-
140-
span.hl-tag,
141-
span.hl-name {
142-
color: rgb(157, 255, 255);
143-
}
144-
145-
span.hl-attr {
146-
color: rgb(254, 213, 5);
147-
}
148-
149-
span.hl-string {
150-
color: rgb(164, 255, 144);
151-
}
152-
}
153-
154-
code.language-css {
155-
span.hl-selector-pseudo {
156-
color: rgb(254, 213, 5);
157-
}
158-
159-
span.hl-attribute {
160-
color: rgb(166, 255, 139);
161-
}
162-
163-
span.hl-string {
164-
color: rgb(249, 230, 123);
165-
}
166-
}
167-
168-
code.language-sql {
169-
170-
span.hl-keyword,
171-
span.hl-type {
172-
color: rgb(249, 230, 123);
173-
}
174-
175-
span.hl-number {
176-
color: rgb(255, 97, 140);
177-
}
178-
}
179-
180-
code.language-yaml {
181-
span.hl-attr {
182-
color: rgb(255, 215, 2);
183-
}
184-
185-
span.hl-string {
186-
color: rgb(164, 255, 144);
187-
}
188-
}
189-
190-
code.language-rust {
191-
192-
span.hl-keyword,
193-
span.hl-punctuation {
194-
color: rgb(255, 158, 0);
195-
}
196-
197-
span.hl-number {
198-
color: rgb(255, 97, 140);
199-
}
200-
201-
span.hl-built_in,
202-
span.hl-title,
203-
span.hl-type,
204-
span.class_,
205-
span.function_,
206-
span.invoke__ {
207-
color: rgb(255, 215, 2);
208-
}
209-
210-
span.hl-string {
211-
color: rgb(164, 255, 144);
212-
}
213-
}
214-
215-
code.language-go {
216-
217-
span.hl-keyword,
218-
span.hl-literal,
219-
span.hl-number {
220-
color: rgb(255, 97, 140);
221-
}
222-
223-
span.hl-title,
224-
span.hl-params,
225-
span.hl-built_in {
226-
color: rgb(255, 215, 2);
227-
}
228-
229-
span.hl-string {
230-
color: rgb(164, 255, 144);
231-
}
232-
233-
span.hl-keyword,
234-
span.hl-type {
235-
color: rgb(255, 158, 0);
236-
}
237-
}
238-
239-
code.language-c {
240-
241-
span.hl-meta span.hl-keyword,
242-
span.hl-type {
243-
color: rgb(255, 158, 0);
244-
}
245-
246-
span.hl-string {
247-
color: rgb(164, 255, 144);
248-
}
249-
250-
span.hl-title,
251-
span.hl-params,
252-
span.hl-built_in {
253-
color: rgb(255, 215, 2);
254-
}
255-
256-
span.hl-literal,
257-
span.hl-number {
258-
color: rgb(255, 97, 140);
259-
}
260-
}
261-
26281
/* GitHub Alert */
26382
.markdown-alert {
26483
padding: 0.5rem 1rem;

0 commit comments

Comments
 (0)