aboutsummaryrefslogtreecommitdiff
path: root/utils/markedOptions.js
diff options
context:
space:
mode:
Diffstat (limited to 'utils/markedOptions.js')
-rw-r--r--utils/markedOptions.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/markedOptions.js b/utils/markedOptions.js
new file mode 100644
index 0000000..ebc7a6f
--- /dev/null
+++ b/utils/markedOptions.js
@@ -0,0 +1,12 @@
+const hljs = require('highlight.js');
+
+function highlight(code, lang) {
+ const language = hljs.getLanguage(lang) ? lang : 'plaintext';
+
+ const highlighted = hljs.highlight(code, { language }).value;
+ return highlighted;
+}
+
+module.exports = {
+ highlight
+}; \ No newline at end of file