mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-25 19:53:21 +02:00
chore: add useKatex option
This commit is contained in:
22
gatsby/on-render-body.js
Normal file
22
gatsby/on-render-body.js
Normal 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;
|
Reference in New Issue
Block a user