Skip to content

Commit

Permalink
feature #12 fix prismjs loading error, related PrismJS/prism#1400
Browse files Browse the repository at this point in the history
  • Loading branch information
ytkj committed Apr 27, 2020
1 parent c388896 commit 0fb05f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/loader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const cheerio = require('cheerio');
const Prism = require('prismjs');
require('prismjs/components/prism-typescript');
const loadLanguages = require('prismjs/components/index');
const classNameUtils = require('./classNameUtils');
const escape = require('./escape');
const option = require('./option');
Expand All @@ -13,6 +13,8 @@ const cheerioOption = {
decodeEntities: false
}

loadLanguages('typescript');

function loader(input, options) {

options = option.assignDefault(options);
Expand All @@ -23,7 +25,7 @@ function loader(input, options) {
const $elements = $(SELECTOR);

if ($elements.length !== 0) {
options.languages.forEach(language => require(`prismjs/components/prism-${language}`));
loadLanguages(options.languages);
}

$elements.each(function(index, element) {
Expand Down

0 comments on commit 0fb05f6

Please sign in to comment.