@tryghost/kg-mobiledoc-html-renderer 5.3.1 → 5.3.2
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.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/lib/mobiledoc-html-renderer.js +19 -1
- package/package.json +3 -3
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -74,6 +74,19 @@ class DomModifier {
|
|
|
74
74
|
node.setAttribute('id', id);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
wrapBlockquoteContentInP(node) {
|
|
78
|
+
if (node.firstChild && node.firstChild.tagName === 'P') {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const p = this.options.dom.createElement('p');
|
|
83
|
+
while (node.firstChild) {
|
|
84
|
+
p.appendChild(node.firstChild);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
node.appendChild(p);
|
|
88
|
+
}
|
|
89
|
+
|
|
77
90
|
modifyChildren(node) {
|
|
78
91
|
walkDom(node, this.modify.bind(this));
|
|
79
92
|
}
|
|
@@ -83,6 +96,11 @@ class DomModifier {
|
|
|
83
96
|
if (node.nodeType === 1 && node.nodeName.match(/^h\d$/i)) {
|
|
84
97
|
this.addHeadingId(node);
|
|
85
98
|
}
|
|
99
|
+
|
|
100
|
+
// wrap blockquote content in P tag for emails
|
|
101
|
+
if (this.options.target === 'email' && node.nodeType === 1 && node.nodeName === 'BLOCKQUOTE') {
|
|
102
|
+
this.wrapBlockquoteContentInP(node);
|
|
103
|
+
}
|
|
86
104
|
}
|
|
87
105
|
}
|
|
88
106
|
|
|
@@ -132,7 +150,7 @@ class MobiledocHtmlRenderer {
|
|
|
132
150
|
|
|
133
151
|
// Walk the DOM output and modify nodes as needed
|
|
134
152
|
// eg. to add ID attributes to heading elements
|
|
135
|
-
const modifier = new DomModifier({
|
|
153
|
+
const modifier = new DomModifier(Object.assign({}, cardOptions, {dom: this.options.dom}));
|
|
136
154
|
modifier.modifyChildren(rendered.result);
|
|
137
155
|
|
|
138
156
|
const output = serializer.serializeChildren(rendered.result);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/kg-mobiledoc-html-renderer",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.2",
|
|
4
4
|
"repository": "https://github.com/TryGhost/Koenig/tree/master/packages/kg-mobiledoc-html-renderer",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"simple-dom": "^1.4.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"c8": "7.
|
|
30
|
+
"c8": "7.11.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d775807eb5039489e68197b9a2c31ae999499beb"
|
|
33
33
|
}
|