diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-07-21 03:59:15 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2021-07-21 03:59:15 -0500 |
commit | 437268370661087dbe31323efb18dfe1a518da33 (patch) | |
tree | cffc95cc50da55eced9ed1e3b68502c68f01ca19 /plugins | |
parent | 51967b62cd274b10326a604d4db670e9e89f8fd5 (diff) | |
download | homepage-437268370661087dbe31323efb18dfe1a518da33.tar.xz homepage-437268370661087dbe31323efb18dfe1a518da33.zip |
Dynamic markdown page generation with preloading
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/withMarkdownLoader.js | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/plugins/withMarkdownLoader.js b/plugins/withMarkdownLoader.js index 7dd51b6..c1e0ac6 100644 --- a/plugins/withMarkdownLoader.js +++ b/plugins/withMarkdownLoader.js @@ -1,12 +1,6 @@ -const hljs = require('highlight.js'); const pluginFactory = require('./pluginFactory'); +const markedOptions = require('../utils/markedOptions'); -function highlight(code, lang) { - const language = hljs.getLanguage(lang) ? lang : 'plaintext'; - - const highlighted = hljs.highlight(code, { language }).value; - return highlighted; -} const withMarkdownLoader = pluginFactory((config, _options) => { config.module.rules.push({ @@ -20,9 +14,7 @@ const withMarkdownLoader = pluginFactory((config, _options) => { }, { loader: 'markdown-loader', - options: { - highlight - } + options: markedOptions } ] }); |