aboutsummaryrefslogtreecommitdiff
path: root/src/app/launcher.js
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-05-03 14:59:11 +0200
committer0neGal <mail@0negal.com>2022-05-03 15:00:26 +0200
commitfc88fc0af4ea3139b81378a03f337a55055a5245 (patch)
tree144e6cf31c3a3c06a174e6f3c0b540d6001e74f6 /src/app/launcher.js
parent3d6dde7ee3d6944a106aca8ad64ad3421f0a9f27 (diff)
downloadViper-fc88fc0af4ea3139b81378a03f337a55055a5245.tar.gz
Viper-fc88fc0af4ea3139b81378a03f337a55055a5245.zip
fixes markdown not rendering properly (#108)
Simplifies the parsing of Markdown, whilst also solving problems that the previous parser for Markdown caused.
Diffstat (limited to 'src/app/launcher.js')
-rw-r--r--src/app/launcher.js39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/app/launcher.js b/src/app/launcher.js
index 7b49dc4..ed6a513 100644
--- a/src/app/launcher.js
+++ b/src/app/launcher.js
@@ -19,40 +19,33 @@ function page(page) {
bgHolder.setAttribute("bg", page);
}; page(1)
-
-// Updates the Viper release notes
-ipcRenderer.on("vp-notes", (event, response) => {
+function formatRelease(notes) {
let content = "";
- for (const release of response) {
+ for (let release of notes) {
if (release.prerelease) {continue}
-
- content += "# " + release.name + "\n\n"
- + release.body.replaceAll("\r\n", "\n") + "\n\n\n";
+ content += "# " + release.name + "\n\n" + release.body + "\n\n\n";
}
- vpReleaseNotes.innerHTML = markdown(content);
-});
-
-async function loadVpReleases() {
- ipcRenderer.send("get-vp-notes");
-}; loadVpReleases();
+ return markdown(content, {
+ breaks: true
+ });
+}
+// Updates the Viper release notes
+ipcRenderer.on("vp-notes", (event, response) => {
+ vpReleaseNotes.innerHTML = formatRelease(response);
+});
// Updates the Northstar release notes
ipcRenderer.on("ns-notes", (event, response) => {
- let content = "";
-
- for (let release of response) {
- if (release.prerelease) {continue}
-
- content += "# " + release.name + "\n\n"
- + release.body.replaceAll("\r\n", "\nhtmlbreak") + "\n\n\n";
- }
-
- nsRelease.innerHTML = markdown(content).replaceAll("htmlbreak", "<br>");
+ nsRelease.innerHTML = formatRelease(response);
});
+async function loadVpReleases() {
+ ipcRenderer.send("get-vp-notes");
+}; loadVpReleases();
+
async function loadNsReleases() {
ipcRenderer.send("get-ns-notes");
}; loadNsReleases();