@tryghost/kg-mobiledoc-html-renderer 5.0.0 → 5.3.0
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.
|
@@ -98,12 +98,25 @@ class MobiledocHtmlRenderer {
|
|
|
98
98
|
|
|
99
99
|
render(mobiledoc, _cardOptions = {}) {
|
|
100
100
|
const ghostVersion = mobiledoc.ghostVersion || '4.0';
|
|
101
|
+
|
|
101
102
|
const defaultCardOptions = {
|
|
102
103
|
ghostVersion,
|
|
103
104
|
target: 'html'
|
|
104
105
|
};
|
|
105
106
|
const cardOptions = Object.assign({}, defaultCardOptions, _cardOptions);
|
|
106
|
-
|
|
107
|
+
|
|
108
|
+
const sectionElementRenderer = {
|
|
109
|
+
ASIDE: function (tagName, dom) {
|
|
110
|
+
// we use ASIDE sections in Koenig as a workaround for applying
|
|
111
|
+
// a different blockquote style because mobiledoc doesn't support
|
|
112
|
+
// storing arbitrary attributes with sections
|
|
113
|
+
const blockquote = dom.createElement('blockquote');
|
|
114
|
+
blockquote.setAttribute('class', 'kg-blockquote-alt kg-width-wide');
|
|
115
|
+
return blockquote;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const rendererOptions = Object.assign({}, this.options, {cardOptions, sectionElementRenderer});
|
|
107
120
|
const renderer = new Renderer(rendererOptions);
|
|
108
121
|
const rendered = renderer.render(mobiledoc);
|
|
109
122
|
const serializer = new SimpleDom.HTMLSerializer(SimpleDom.voidMap);
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/kg-mobiledoc-html-renderer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
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 mocha './test/**/*.test.js'",
|
|
10
|
+
"test": "NODE_ENV=testing c8 --reporter text --reporter cobertura mocha './test/**/*.test.js'",
|
|
11
11
|
"lint": "eslint . --ext .js --cache",
|
|
12
12
|
"posttest": "yarn lint"
|
|
13
13
|
},
|
|
14
14
|
"engines": {
|
|
15
|
-
"node": "^12.22.1 || ^14.16.
|
|
15
|
+
"node": "^12.22.1 || ^14.17.0 || ^16.13.0"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
18
|
"index.js",
|
|
@@ -26,5 +26,8 @@
|
|
|
26
26
|
"semver": "^7.3.4",
|
|
27
27
|
"simple-dom": "^1.4.0"
|
|
28
28
|
},
|
|
29
|
-
"
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"c8": "7.10.0"
|
|
31
|
+
},
|
|
32
|
+
"gitHead": "050de1323b4051a0424a69b6aba0c790f6e38aeb"
|
|
30
33
|
}
|