@tryghost/kg-mobiledoc-html-renderer 5.3.2 → 5.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  const SimpleDom = require('simple-dom');
2
- const semver = require('semver');
3
2
  const Renderer = require('mobiledoc-dom-renderer').default;
3
+ const {slugify} = require('@tryghost/kg-utils');
4
4
 
5
5
  const walkDom = function (node, func) {
6
6
  func(node);
@@ -24,29 +24,6 @@ const nodeTextContent = function (node) {
24
24
  return textContent;
25
25
  };
26
26
 
27
- const slugify = function (inputString, {ghostVersion = '4.0'} = {}) {
28
- const version = semver.coerce(ghostVersion);
29
-
30
- if (semver.satisfies(version, '<4.x')) {
31
- // backwards compatible slugs used in Ghost 2.x to 3.x mobiledoc
32
- return inputString.replace(/[<>&"?]/g, '')
33
- .trim()
34
- .replace(/[^\w]/g, '-')
35
- .replace(/-{2,}/g, '-')
36
- .toLowerCase();
37
- } else {
38
- // news slugs introduced in 4.0
39
- // allows all chars except symbols but will urlEncode everything
40
- // produces %-encoded chars in src but browsers show real chars in status bar and url bar
41
- return encodeURIComponent(inputString.trim()
42
- .toLowerCase()
43
- .replace(/[\][!"#$%&'()*+,./:;<=>?@\\^_{|}~]/g, '')
44
- .replace(/\s+/g, '-')
45
- .replace(/^-|-{2,}|-$/g, '')
46
- );
47
- }
48
- };
49
-
50
27
  // used to walk the rendered SimpleDOM output and modify elements before
51
28
  // serializing to HTML. Saves having a large HTML parsing dependency such as
52
29
  // jsdom that may break on malformed HTML in MD or HTML cards
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@tryghost/kg-mobiledoc-html-renderer",
3
- "version": "5.3.2",
3
+ "version": "5.3.5",
4
4
  "repository": "https://github.com/TryGhost/Koenig/tree/master/packages/kg-mobiledoc-html-renderer",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
7
7
  "main": "index.js",
8
8
  "scripts": {
9
9
  "dev": "echo \"Implement me!\"",
10
- "test": "NODE_ENV=testing c8 --reporter text --reporter cobertura mocha './test/**/*.test.js'",
10
+ "test": "NODE_ENV=testing c8 --all --reporter text --reporter cobertura mocha './test/**/*.test.js'",
11
11
  "lint": "eslint . --ext .js --cache",
12
12
  "posttest": "yarn lint"
13
13
  },
@@ -22,12 +22,12 @@
22
22
  "access": "public"
23
23
  },
24
24
  "dependencies": {
25
+ "@tryghost/kg-utils": "^1.0.2",
25
26
  "mobiledoc-dom-renderer": "^0.7.0",
26
- "semver": "^7.3.4",
27
27
  "simple-dom": "^1.4.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "c8": "7.11.0"
31
31
  },
32
- "gitHead": "d775807eb5039489e68197b9a2c31ae999499beb"
32
+ "gitHead": "1ce572e770cf82c5a2ebdd9b4a01cc53567c5d26"
33
33
  }