This repository has been archived by the owner on Jan 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrender.js
59 lines (54 loc) · 1.74 KB
/
render.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const render = parsed => `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${parsed.title}</title>
<meta name="description" content="${parsed.excerpt}">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
line-height: 1.6;
color: #222;
max-width: 40rem;
padding: 2rem;
margin: auto;
background: #fafafa;
}
img {
max-width: 100%;
}
a {
color: #2ECC40;
}
h1,
h2,
strong {
color: #111;
}
@media (prefers-color-scheme: dark) {
body {
background-color: black;
color: #ccc;
}
h1, h2, strong {
color: #e0e0e0;
}
}
</style>
</head>
<body>
<div style="text-align: center">
<h2>A reader mode sharable url built with Cloudflare workers</h2>
<i>If you find a bug with the generated text, please find an issue over <a href="https://github.com/tuananh/reader/issues/new" target="_blank" rel="noopener">GitHub</a>.</i>
<br />
<a href="${parsed.url}" target="_blank" rel="noopener">View the original article</a>
</div>
</hr>
<h1>${parsed.title}</h1>
<strong>${parsed.byline || parsed.siteName}</strong>
${parsed.content}
</body>
</html>
`
module.exports = render