@tryghost/kg-mobiledoc-html-renderer
Advanced tools
Comparing version 5.3.2 to 5.3.3
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 |
{ | ||
"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" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7011
116
+ Added@tryghost/kg-utils@^1.0.0
+ Added@tryghost/kg-utils@1.0.28(transitive)
- Removedsemver@^7.3.4