From c924fc1d2f569611c861d5ab8a58809ed080f6ec Mon Sep 17 00:00:00 2001 From: Michael Maltsev <4129781+m417z@users.noreply.github.com> Date: Tue, 12 Sep 2023 08:49:08 +0300 Subject: [PATCH] Support trailing backslashes as newlines in RSS generation --- deploy.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/deploy.ts b/deploy.ts index 68746507a..2785ff48f 100644 --- a/deploy.ts +++ b/deploy.ts @@ -281,12 +281,20 @@ function generateRssFeed() { const showdownConverter = new showdown.Converter(); + const markdownToHtml = (markdown: string) => { + // Showdown doesn't support trailing backslashes as newlines. Use double + // spaces instead. https://github.com/showdownjs/showdown/issues/394 + markdown = markdown.replace(/\\\n/g, ' \n'); + + return showdownConverter.makeHtml(markdown); + } + for (const feedItem of feedItems) { feed.addItem({ title: feedItem.title, id: feedItem.url + '#' + feedItem.commit, link: feedItem.url, - content: showdownConverter.makeHtml(feedItem.content), + content: markdownToHtml(feedItem.content), date: feedItem.date, }); } @@ -295,6 +303,9 @@ function generateRssFeed() { } async function main() { + fs.writeFileSync('updates.atom', generateRssFeed()); + return; + const catalog = await generateModCatalog(); fs.writeFileSync('catalog.json', JSONstringifyOrder(catalog, 4));