chore: add useKatex option

This commit is contained in:
alxshelepenok
2019-07-19 20:42:20 +03:00
parent f6860c8a75
commit d5d6b2bf50
70 changed files with 39 additions and 18 deletions

22
gatsby/on-render-body.js Normal file
View File

@@ -0,0 +1,22 @@
'use strict';
const React = require('react');
const siteConfig = require('../config.js');
// eslint-disable-next-line import/no-webpack-loader-syntax, import/no-unresolved
const katexStylesheet = require('!css-loader!../static/css/katex/katex.min.css');
const onRenderBody = ({ setHeadComponents }) => {
const { useKatex } = siteConfig;
if (useKatex) {
setHeadComponents([
React.createElement('style', {
key: 'katex-inline-stylesheet',
dangerouslySetInnerHTML: { __html: katexStylesheet.toString() }
})
]);
}
};
module.exports = onRenderBody;