1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { timeAgo } from "https://esm.town/v/rodrigotello/timeAgo";
import { hnPrefixURL } from "https://esm.town/v/stevekrouse/hnPrefixURL?v=1";
export let hnCommentToHTML = async ({
author,
story_title,
objectID,
story_id,
comment_text,
created_at,
}) => `
<div style="color:gray">
<div style="font-size:1.2em">đŸ’¬ <span style="text-decoration:none; color:#334155">"${comment_text}"</span></div>
<div style="display:inline-block">commented by <a style="color:gray" href="https://news.ycombinator.com/user?id=${author}">${author}</a></div>
<div style="display:inline-block">, <a href="${
hnPrefixURL
}${objectID}" style="color:gray">${await timeAgo(
created_at
)}</a></div>
<div style="display:inline-block">, on <a href="${
hnPrefixURL
}${story_id}" style="color:gray">${story_title}</a></div>
<div style="height:24px"></div>
</div>`;
// Forked from @stevekrouse.hnCommentToText
1
Next