Socket
Socket
Sign inDemoInstall

@tryghost/kg-mobiledoc-html-renderer

Package Overview
Dependencies
Maintainers
20
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tryghost/kg-mobiledoc-html-renderer - npm Package Compare versions

Comparing version 5.3.2 to 5.3.3

25

lib/mobiledoc-html-renderer.js
const SimpleDom = require('simple-dom');
const semver = require('semver');
const Renderer = require('mobiledoc-dom-renderer').default;
const {slugify} = require('@tryghost/kg-utils');

@@ -27,25 +27,2 @@ const walkDom = function (node, func) {

const slugify = function (inputString, {ghostVersion = '4.0'} = {}) {
const version = semver.coerce(ghostVersion);
if (semver.satisfies(version, '<4.x')) {
// backwards compatible slugs used in Ghost 2.x to 3.x mobiledoc
return inputString.replace(/[<>&"?]/g, '')
.trim()
.replace(/[^\w]/g, '-')
.replace(/-{2,}/g, '-')
.toLowerCase();
} else {
// news slugs introduced in 4.0
// allows all chars except symbols but will urlEncode everything
// produces %-encoded chars in src but browsers show real chars in status bar and url bar
return encodeURIComponent(inputString.trim()
.toLowerCase()
.replace(/[\][!"#$%&'()*+,./:;<=>?@\\^_{|}~]/g, '')
.replace(/\s+/g, '-')
.replace(/^-|-{2,}|-$/g, '')
);
}
};
// used to walk the rendered SimpleDOM output and modify elements before

@@ -52,0 +29,0 @@ // serializing to HTML. Saves having a large HTML parsing dependency such as

6

package.json
{
"name": "@tryghost/kg-mobiledoc-html-renderer",
"version": "5.3.2",
"version": "5.3.3",
"repository": "https://github.com/TryGhost/Koenig/tree/master/packages/kg-mobiledoc-html-renderer",

@@ -25,4 +25,4 @@ "author": "Ghost Foundation",

"dependencies": {
"@tryghost/kg-utils": "^1.0.0",
"mobiledoc-dom-renderer": "^0.7.0",
"semver": "^7.3.4",
"simple-dom": "^1.4.0"

@@ -33,3 +33,3 @@ },

},
"gitHead": "d775807eb5039489e68197b9a2c31ae999499beb"
"gitHead": "615a20445876522e113a8770ada332e8c00d939b"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc