Skip to content

Commit dd59338

Browse files
authored
Update README and the webpage (#54)
2 parents 01367a0 + 0f90faf commit dd59338

4 files changed

Lines changed: 138 additions & 225 deletions

File tree

.github/site/homepage.md

Lines changed: 0 additions & 155 deletions
This file was deleted.

.github/site/index.html

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,62 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<title>Ghostbird: GhostText for Thunderbird</title>
6-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
7-
<meta name="description" content="Ghostbird is a Thunderbird add-on that connects your text editor with Thunderbird's email compose window, allowing you to edit the message in the text editor.">
8-
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
9-
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify@4.13.1/lib/themes/vue.min.css">
10-
<link rel="icon" href="ext/blue.svg">
11-
<script type="module" src="index.mjs"></script>
12-
<style>
13-
section.cover blockquote { margin: 0 }
14-
</style>
15-
<meta property="og:image" content="https://repository-images.githubusercontent.com/1054373981/354c0de9-d238-4139-a9ed-ba116f3d439e">
16-
<meta property="og:image:alt" content="Ghostbird: GhostText for Thunderbird">
17-
<meta property="og:type" content="website">
18-
<meta property="og:title" content="Ghostbird: GhostText for Thunderbird">
19-
<meta property="og:url" content="https://exteditor.github.io/ghostbird/">
20-
<meta property="og:description" content="Ghostbird: Compose emails using your favorite text editor in Thunderbird">
21-
</head>
22-
<body>
23-
<div id="app"><a href="https://github.com/exteditor/ghostbird/">&#x1faba; GitHub</a></div>
24-
</body>
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Ghostbird: GhostText for Thunderbird</title>
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7+
<meta
8+
name="description"
9+
content="Ghostbird is a Thunderbird add-on that connects your text editor with Thunderbird's email compose window, allowing you to edit the message in the text editor."
10+
>
11+
<meta
12+
name="viewport"
13+
content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
14+
>
15+
<link rel="icon" href="ext/blue.svg">
16+
<link
17+
rel="stylesheet"
18+
href="//cdn.jsdelivr.net/npm/docsify@4.13.1/lib/themes/vue.css"
19+
integrity="sha256-H43c3hD+HZ86tg3oRp7Sb5sJcW+4grIl1mbU9ig43i4="
20+
crossorigin="anonymous"
21+
>
22+
<script type="importmap">
23+
{
24+
"imports": {
25+
"mermaid": "https://cdn.jsdelivr.net/npm/mermaid@11.12.0/dist/mermaid.esm.min.mjs",
26+
"docsify": "https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/docsify.min.js",
27+
"docsify/plugins/search": "https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/plugins/search.min.js"
28+
},
29+
"integrity": {
30+
"https://cdn.jsdelivr.net/npm/mermaid@11.12.0/dist/mermaid.esm.min.mjs": "sha256-dloSMf8Nxfp4hkTMnxf4acGB56KK1OVj0kMlsNrZPRM=",
31+
"https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/docsify.min.js": "sha256-kSP4CNP2rXNrSo+ZlEphH4fF1PkygDAIClwCntX0UKU=",
32+
"https://cdn.jsdelivr.net/npm/docsify@4.13.1/lib/plugins/search.min.js": "sha256-qyB5Lcad/ZzbGUefcW9pphnld97EUnORlncBNN1x8pc="
33+
}
34+
}
35+
</script>
36+
<script type="module" src="index.mjs"></script>
37+
<style>
38+
section.cover blockquote { margin: 0 }
39+
</style>
40+
<meta
41+
property="og:image"
42+
content="https://repository-images.githubusercontent.com/1054373981/354c0de9-d238-4139-a9ed-ba116f3d439e"
43+
>
44+
<meta
45+
property="og:image:alt"
46+
content="Ghostbird: GhostText for Thunderbird"
47+
>
48+
<meta property="og:type" content="website">
49+
<meta property="og:title" content="Ghostbird: GhostText for Thunderbird">
50+
<meta property="og:url" content="https://exteditor.github.io/ghostbird/">
51+
<meta
52+
property="og:description"
53+
content="Ghostbird lets you compose emails using your favorite text editor in Thunderbird"
54+
>
55+
</head>
56+
57+
<body>
58+
<div id="app">
59+
<a href="https://github.com/exteditor/ghostbird/">&#x1faba; GitHub</a>
60+
</div>
61+
</body>
2562
</html>

.github/site/index.mjs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@11.12.0/+esm";
2-
import "https://cdn.jsdelivr.net/npm/docsify@4.13.1/+esm";
1+
import mermaid from "mermaid";
2+
import "docsify";
33

44
// @ts-check
55

6-
mermaid.initialize({ startOnLoad: false });
7-
86
/**
97
* Build a URL to a GitHub resource
108
* @param {string} type The type of resource ('blob' or 'tree')
@@ -18,12 +16,12 @@ const urlFor = (type, path) => `https://github.com/exteditor/ghostbird/${encodeU
1816
* @param {string} url The URL to redirect to
1917
* @returns {string} A Markdown text
2018
*/
21-
const redirectTo = (url) => JSON.stringify({redirectTo: url});
19+
const redirectTo = (url) => JSON.stringify({ redirectTo: url });
2220

2321
/**
2422
* Does redirect if the text is an instruction for it.
2523
* @param {string} text A Markdown text that may contain a redirect instruction
26-
* @returns {string} Returns the `text` as-is if it doesn't contain redirect instruction
24+
* @returns {string | undefined} a message if the text is a redirect instruction; `undefined` otherwise
2725
*/
2826
function tryRedirect(text) {
2927
try {
@@ -35,12 +33,20 @@ function tryRedirect(text) {
3533
} catch (e) {
3634
console.warn("failed to parse the redirect instruction", e);
3735
}
38-
return text;
36+
return undefined;
3937
}
4038

39+
/**
40+
* Fix some emojis Docsify doesn't recognize
41+
* @param {string} text The Markdown text
42+
* @returns {string} Markdown text processed
43+
*/
44+
const fixEmoji = (text) => text.replaceAll(':nest_with_eggs:', '\u{1faba}');
45+
4146
/**
4247
* Add a footer to the Markdown text
4348
* @param {string} text The Markdown text
49+
* @param {import('docsify').Docsify} vm Info about the page
4450
* @returns {string} Markdown text with footer added
4551
*/
4652
const addFooter = (text, vm) => `${text}
@@ -65,15 +71,13 @@ window.$docsify = {
6571
formatUpdated: '{YYYY}-{MM}-{DD}',
6672
relativePath: true,
6773
executeScript: false,
68-
homepage: "homepage.md",
6974
coverpage: "coverpage.md",
7075
loadNavbar: "navbar.md",
7176
mergeNavbar: true,
7277
auto2top: true,
7378
maxLevel: 3,
7479
themeColor: '#0b9dd6',
7580
routes: {
76-
'/README': (route) => redirectTo(urlFor('blob', `${route}.md`)),
7781
'/LICENSE': (route) => redirectTo(urlFor('blob', route)),
7882
'/[-._/a-zA-Z]*[.][a-zA-Z]+$': (route) => redirectTo(urlFor('blob', route)),
7983
'/[-._/a-zA-Z]+/$': (route) => redirectTo(urlFor('tree', route)),
@@ -84,6 +88,7 @@ window.$docsify = {
8488
'/CONTRIBUTING',
8589
'/doc/faq',
8690
'/doc/faq-architectural',
91+
'/doc/design',
8792
'/doc/building',
8893
'/doc/testing',
8994
],
@@ -99,9 +104,17 @@ window.$docsify = {
99104
},
100105
plugins: [
101106
(hook, vm) => {
102-
hook.beforeEach((text) => tryRedirect(text));
103-
hook.beforeEach((text) => addFooter(text, vm));
107+
hook.beforeEach((text) =>
108+
tryRedirect(text) ??
109+
addFooter(fixEmoji(text), vm) ??
110+
text
111+
);
104112
hook.doneEach(() => mermaid.run());
105113
},
106114
],
107115
};
116+
117+
mermaid.initialize({ startOnLoad: false });
118+
119+
// load the plugin here having the global `$docsify` defined
120+
await import("docsify/plugins/search");

0 commit comments

Comments
 (0)