Skip to content

Commit f2a4992

Browse files
committed
adjustments on mash items presentation
1 parent 338018f commit f2a4992

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

.github/scripts/gen-feed.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ for (const {name, isFile} of Deno.readDirSync(`./blog/content`)) {
5050
}
5151

5252
for (const script of JSON.parse(Deno.readTextFileSync(scripthubJson)).scripts) {
53-
const { fullname, description, birthtime, avatar } = script
53+
const { cmd, fullname, description, birthtime, avatar } = script
5454
const url = `https://mash.pkgx.sh/${fullname}`
5555
if (description) rv.push({
56-
type: 'script',
56+
type: 'mash',
5757
time: new Date(birthtime),
58-
description: description.split(". ")?.[0] ?? description,
59-
title: fullname,
58+
description: demarkdown(description.split(". ")?.[0] ?? description),
59+
title: cmd,
6060
image: avatar,
6161
url
6262
})
@@ -65,3 +65,7 @@ for (const script of JSON.parse(Deno.readTextFileSync(scripthubJson)).scripts) {
6565
rv.sort((a, b) => b.time.getTime() - a.time.getTime())
6666

6767
console.log(JSON.stringify(rv))
68+
69+
function demarkdown(input: any): string | undefined {
70+
return input.replaceAll(/\[([^\]]+)\]\([^)]+\)/g, '$1');
71+
}

src/pkgx.dev/HomeFeed.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ function FeedItemBox(item: FeedItem) {
184184
const color = (() => {
185185
switch (type) {
186186
case 'blog': return 'secondary'
187-
case 'script': return 'primary'
187+
case 'mash': return 'primary'
188188
}
189189
})()
190190

src/utils/FeedItem.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
type FeedItem = {
3-
type: 'blog' | 'pkg' |'script' | 'highlight'
3+
type: 'blog' | 'pkg' |'mash' | 'highlight'
44
url: string,
55
title: string,
66
time: Date,

0 commit comments

Comments
 (0)