<commit_before>"use strict";

const url = require('url')
const path = require('path')
const loaderUtils = require('loader-utils')
const frontMatter = require('front-matter')
const Prism = require('prismjs')
const MDXC = require('mdxc')


const env = {};


const aliases = {
  'js': 'jsx',
  'html': 'markup',
  'mdx': 'markdown',
  'md': 'markdown'
}
function highlight(str, lang) {
  if (!lang) {
    return str
  } else {
    lang = aliases[lang] || lang
    require(`prismjs/components/prism-${lang}.js`)
    if (Prism.languages[lang]) {
      return Prism.highlight(str, Prism.languages[lang])
    } else {
      return str
    }
  }
}
<commit_msg>Changes mdx-loader to check for prism language before trying to dynamically require the corresponding language file.<commit_after>"use strict";

const url = require('url')
const path = require('path')
const loaderUtils = require('loader-utils')
const frontMatter = require('front-matter')
const Prism = require('prismjs')
const MDXC = require('mdxc')


const env = {};


const aliases = {
  'js': 'jsx',
  'html': 'markup',
  'mdx': 'markdown',
  'md': 'markdown'
}
function highlight(str, lang) {
  if (!lang) {
    return str
  } else {
    lang = aliases[lang] || lang
    if (Prism.languages[lang]) {
      require(`prismjs/components/prism-${lang}.js`)
      return Prism.highlight(str, Prism.languages[lang])
    } else {
      return str
    }
  }
}

{'fraction_non_alphanumeric': 0.1603974449964514, 'fraction_numerical': 0.0, 'mean_word_length': 3.7315436241610738, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1049577', 'n_tokens_mistral': 485, 'n_tokens_neox': 462, 'n_words': 119}