From 4727f3a951582074b33fadc4d2e7ef97ffb4b7ea Mon Sep 17 00:00:00 2001 From: Merritt Krakowitzer Date: Tue, 8 Sep 2020 13:46:53 +0100 Subject: [PATCH] Add Highlight.js support --- Dockerfile | 2 +- makepdfs.js | 4 ++-- package.json | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0bf931f..1b6b5fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN apt-get update && \ libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget curl && \ rm -rf /var/lib/apt/lists/* -RUN npm install puppeteer markdown-it mustache markdown-it-named-headers cheerio +RUN npm install puppeteer markdown-it mustache markdown-it-named-headers cheerio markdown-it-highlightjs COPY makepdfs.js / COPY package.json / COPY template/ template/ diff --git a/makepdfs.js b/makepdfs.js index 9ac43ef..ffdae65 100755 --- a/makepdfs.js +++ b/makepdfs.js @@ -48,7 +48,7 @@ function makePdf(data,file) { const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch( { - executablePath:'/node_modules/puppeteer/.local-chromium/linux-706915/chrome-linux/chrome', + executablePath:'/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome', args: [ '--headless', '--no-sandbox', @@ -115,7 +115,7 @@ fs.readdir (mddir,function(err, files) { } return '
' + str + '
'; } - }); + }).use(require('markdown-it-highlightjs'), { inline: true }); var options = { slugify: Slug } diff --git a/package.json b/package.json index 309b6ef..64ead39 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "dependencies": { "puppeteer": "1.15.0", "commander": "2.20.0", - "markdown-it": "8.4.2" + "markdown-it": "11.0.0" + "markdown-it-highlightjs": "3.2.0" } }