fix: Empty anchors no longer crash the rendering process

This commit is contained in:
NGPixel 2017-05-01 22:01:45 -04:00 committed by Nicolas Giard
parent f2bcc378d5
commit a9ed499006
4 changed files with 113 additions and 449 deletions

View File

@ -66,7 +66,7 @@
"highlight.js": "^9.11.0", "highlight.js": "^9.11.0",
"i18next": "^8.1.0", "i18next": "^8.1.0",
"i18next-express-middleware": "^1.0.5", "i18next-express-middleware": "^1.0.5",
"i18next-node-fs-backend": "^0.1.3", "i18next-node-fs-backend": "^1.0.0",
"image-size": "^0.5.1", "image-size": "^0.5.1",
"jimp": "https://github.com/ngpixel/jimp.git", "jimp": "https://github.com/ngpixel/jimp.git",
"js-yaml": "^3.8.3", "js-yaml": "^3.8.3",
@ -89,7 +89,7 @@
"moment": "^2.18.1", "moment": "^2.18.1",
"moment-timezone": "^0.5.13", "moment-timezone": "^0.5.13",
"mongodb": "^2.2.26", "mongodb": "^2.2.26",
"mongoose": "^4.9.6", "mongoose": "^4.9.7",
"multer": "^1.3.0", "multer": "^1.3.0",
"ora": "^1.2.0", "ora": "^1.2.0",
"passport": "^0.3.2", "passport": "^0.3.2",
@ -103,7 +103,7 @@
"passport-windowslive": "^1.0.2", "passport-windowslive": "^1.0.2",
"passport.socketio": "^3.7.0", "passport.socketio": "^3.7.0",
"pm2": "^2.4.6", "pm2": "^2.4.6",
"pug": "^2.0.0-beta11", "pug": "^2.0.0-rc.1",
"read-chunk": "^2.0.0", "read-chunk": "^2.0.0",
"remove-markdown": "^0.1.0", "remove-markdown": "^0.1.0",
"request": "^2.81.0", "request": "^2.81.0",
@ -149,7 +149,7 @@
"standard": "latest", "standard": "latest",
"twemoji-awesome": "^1.0.6", "twemoji-awesome": "^1.0.6",
"uglify-js": "latest", "uglify-js": "latest",
"vee-validate": "^2.0.0-beta.25", "vee-validate": "^2.0.0-rc.2",
"vue": "^2.3.0" "vue": "^2.3.0"
}, },
"standard": { "standard": {

View File

@ -102,7 +102,7 @@ module.exports = (port, spinner) => {
}, },
() => { () => {
const os = require('os') const os = require('os')
if (os.totalmem() < 1024 * 1024 * 768) { if (os.totalmem() < 1000 * 1000 * 768) {
throw new Error('Not enough memory. Minimum is 768 MB.') throw new Error('Not enough memory. Minimum is 768 MB.')
} }
return _.round(os.totalmem() / (1024 * 1024)) + ' MB of system memory available. Minimum is 768 MB.' return _.round(os.totalmem() / (1024 * 1024)) + ' MB of system memory available. Minimum is 768 MB.'

View File

@ -110,7 +110,7 @@ const parseTree = (content) => {
if (heading.type === 'inline') { if (heading.type === 'inline') {
let content = '' let content = ''
let anchor = '' let anchor = ''
if (heading.children && heading.children[0].type === 'link_open') { if (heading.children && heading.children.length > 0 && heading.children[0].type === 'link_open') {
content = heading.children[1].content content = heading.children[1].content
anchor = _.kebabCase(content) anchor = _.kebabCase(content)
} else { } else {

550
yarn.lock

File diff suppressed because it is too large Load Diff