Skip to content

Commit

Permalink
Merge pull request #29 from Git-Leon/main
Browse files Browse the repository at this point in the history
added the following languages to hljs language registry: bash, batch,…
  • Loading branch information
bonartm authored Sep 7, 2022
2 parents 493b15f + e69f0d1 commit 17068ba
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/extensions/quizdownHighlight.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import hljs from 'highlight.js/lib/core';
import bash from 'highlight.js/lib/languages/bash';
import batch from 'highlight.js/lib/languages/dos';
import java from 'highlight.js/lib/languages/java';
import javascript from 'highlight.js/lib/languages/javascript';
import plaintext from 'highlight.js/lib/languages/plaintext';
import python from 'highlight.js/lib/languages/python';
import typescript from 'highlight.js/lib/languages/typescript';
import xml from 'highlight.js/lib/languages/xml';
import plaintext from 'highlight.js/lib/languages/plaintext';
import type { QuizdownExtension } from '../quizdown.js';

// this does not work....
Expand All @@ -10,9 +15,14 @@ import type { QuizdownExtension } from '../quizdown.js';
// hljs.registerLanguage(langName, langModule);
// });

hljs.registerLanguage('bash', bash);
hljs.registerLanguage('batch', batch);
hljs.registerLanguage('java', java);
hljs.registerLanguage('javascript', javascript);
hljs.registerLanguage('plaintext', plaintext);
hljs.registerLanguage('python', python);
hljs.registerLanguage('typescript', typescript);
hljs.registerLanguage('html', xml);
hljs.registerLanguage('plaintext', plaintext);

function highlighter(code, language) {
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext';
Expand Down

0 comments on commit 17068ba

Please sign in to comment.