diff --git a/node/rss.js b/node/rss.js index 76bf97d..31ac99c 100644 --- a/node/rss.js +++ b/node/rss.js @@ -1,6 +1,9 @@ const { Feed } = require("feed"); +const { + JSDOM +} = require("jsdom"); const fs = require("fs"); const converter = require("./showdown")(1); @@ -40,13 +43,24 @@ function createFeed(callback) { const post = json[i]; const date = new Date(post.date); const index = i; - fs.readFile(`${__dirname}/../blog/src/${post.id}.md`, function (_, content) { - let html = converter.makeHtml(content.toString()); + let extension = post.book ? "html" : "md"; + fs.readFile(`${__dirname}/../blog/src/${post.id}.${extension}`, function (_, file) { + let content; + if (post.book) { + let html = new JSDOM(file); + let page = html.window.document.getElementById("page"); + let header = page.getElementsByTagName("header"); + while (header.length > 0) + header[0].parentNode.removeChild(header[0]); + content = page.innerHTML; + } else { + content = converter.makeHtml(file.toString()); + } feed.addItem({ title: `${post.name}${post.archived ? " (Archived)" : ""}`, link: `https://ellpeck.de/blog/${post.id}`, description: post.summary, - content: html, + content: content, date: date, published: date, category: post.cat.map(c => ({ diff --git a/style/book.css b/style/book.css index 690a276..acafda1 100644 --- a/style/book.css +++ b/style/book.css @@ -42,4 +42,10 @@ h6 { margin-top: 1em; margin-bottom: 1em; font-weight: bold; +} + +@media (max-width: 768px) { + .list-display { + max-width: 35.5em; + } } \ No newline at end of file