This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/website/src/theme/prism-include-languages.js
Andrea Luzzardi e9b952a882 docs: rename tools/daggosaurus to website
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2021-06-04 13:49:20 -07:00

25 lines
760 B
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
import siteConfig from "@generated/docusaurus.config";
const prismIncludeLanguages = (PrismObject) => {
if (ExecutionEnvironment.canUseDOM) {
const {
themeConfig: { prism: { additionalLanguages = [] } = {} },
} = siteConfig;
window.Prism = PrismObject;
additionalLanguages.forEach((lang) => {
require(`prismjs/components/prism-${lang}`); // eslint-disable-line
});
require("./prism.cue.js");
delete window.Prism;
}
};
export default prismIncludeLanguages;