fix: replace use of deepmerge with _.merge (#1430)

This commit is contained in:
Yangshun Tay 2019-05-02 08:00:28 -07:00 committed by Endi
parent 578c53a936
commit 64fdafbcea
5 changed files with 13 additions and 8 deletions

View file

@ -247,6 +247,10 @@ Hostname of your server. Useful if you are using GitHub Enterprise.
Path to your web app manifest (e.g., `manifest.json`). This will add a `<link>` tag to `<head>` with `rel` as `"manifest"` and `href` as the provided path.
#### `markdownOptions` [object]
Override default [Remarkable options](https://github.com/jonschlinkert/remarkable#options) that will be used to render markdown.
#### `markdownPlugins` [array]
An array of plugins to be loaded by Remarkable, the markdown parser and renderer used by Docusaurus. The plugin will receive a reference to the Remarkable instance, allowing custom parsing and rendering rules to be defined.

View file

@ -5,11 +5,11 @@
* LICENSE file in the root directory of this source tree.
*/
const _ = require('lodash');
const hljs = require('highlight.js');
const Markdown = require('remarkable');
const prismjs = require('prismjs');
const loadLanguages = require('prismjs/components/index');
const deepmerge = require('deepmerge');
const chalk = require('chalk');
const anchors = require('./anchors.js');
@ -88,7 +88,7 @@ class MarkdownRenderer {
// Allow overriding default options
if (siteConfig.markdownOptions) {
markdownOptions = deepmerge(
markdownOptions = _.merge(
{},
markdownOptions,
siteConfig.markdownOptions,

View file

@ -26,7 +26,7 @@ const fs = require('fs-extra');
const glob = require('glob');
const mkdirp = require('mkdirp');
const nodePath = require('path');
const deepmerge = require('deepmerge');
const _ = require('lodash');
const readMetadata = require('./server/readMetadata.js');
@ -43,7 +43,8 @@ let customTranslations = {
'pages-strings': {},
};
if (fs.existsSync(`${CWD}/data/custom-translation-strings.json`)) {
customTranslations = deepmerge(
customTranslations = _.merge(
{},
JSON.parse(
fs.readFileSync(`${CWD}/data/custom-translation-strings.json`, 'utf8'),
),
@ -187,7 +188,8 @@ function execute() {
translations['pages-strings'],
customTranslations['pages-strings'],
);
translations['localized-strings'] = deepmerge(
translations['localized-strings'] = _.merge(
{},
translations['localized-strings'],
customTranslations['localized-strings'],
);

View file

@ -44,7 +44,6 @@
"cross-spawn": "^6.0.5",
"crowdin-cli": "^0.3.0",
"cssnano": "^3.10.0",
"deepmerge": "^2.1.1",
"escape-string-regexp": "^1.0.5",
"express": "^4.15.3",
"feed": "^1.1.0",

View file

@ -21,7 +21,7 @@ function Layout(props) {
return (
<React.Fragment>
<Head defaultTitle={`${defaultTitle} · ${tagline}`}>
{title && <title>{title}</title>}
{title && <title>{`${title} · ${tagline}`}</title>}
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
</Head>
<Navbar />