@tryghost/kg-mobiledoc-html-renderer
Advanced tools
Comparing version 1.0.0 to 2.0.0
@@ -79,16 +79,12 @@ const SimpleDom = require('simple-dom'); | ||
render(mobiledoc, version) { | ||
render(mobiledoc, cardOptions = {}) { | ||
const rendererOptions = Object.assign({}, this.options, {cardOptions}); | ||
/** | ||
* @deprecated: version 1 === Ghost 1.0 markdown-only mobiledoc | ||
* We keep the version 1 logic till Ghost 3.0 to be able to rollback posts. | ||
* | ||
* version 1 === Ghost 1.0 markdown-only mobiledoc | ||
* version 2 (latest) === Ghost 2.0 full mobiledoc | ||
*/ | ||
version = version || 2; | ||
rendererOptions.cardOptions.version = rendererOptions.cardOptions.version || 2; | ||
rendererOptions.cardOptions.target = 'html'; | ||
const versionedOptions = Object.assign({}, this.options, { | ||
cardOptions: {version} | ||
}); | ||
const renderer = new Renderer(versionedOptions); | ||
const renderer = new Renderer(rendererOptions); | ||
const rendered = renderer.render(mobiledoc); | ||
@@ -111,3 +107,8 @@ const serializer = new SimpleDom.HTMLSerializer(SimpleDom.voidMap); | ||
return serializer.serializeChildren(rendered.result); | ||
const output = serializer.serializeChildren(rendered.result); | ||
// clean up any DOM that could be kept around in our SimpleDom instance | ||
rendered.teardown(); | ||
return output; | ||
} | ||
@@ -114,0 +115,0 @@ } |
{ | ||
"name": "@tryghost/kg-mobiledoc-html-renderer", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"repository": "https://github.com/TryGhost/Koenig/tree/master/packages/kg-mobiledoc-html-renderer", | ||
@@ -25,3 +25,3 @@ "author": "Ghost Foundation", | ||
}, | ||
"gitHead": "a3521a8eddb697c497ea993ba6577a87f64a0c11" | ||
"gitHead": "b4b326712490c098ca67e6ab25a4122212edcbc1" | ||
} |
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
5755