1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-02 22:49:09 +02:00

Fixed tests

This commit is contained in:
Laurent Cozic
2020-02-14 09:43:22 +00:00
parent c63d8a70b8
commit a52c261d95

View File

@@ -226,14 +226,7 @@ class MdToHtml {
const pluginAssets = this.processPluginAssets(context.pluginAssets); const pluginAssets = this.processPluginAssets(context.pluginAssets);
cssStrings = cssStrings.concat(pluginAssets.cssStrings); cssStrings = cssStrings.concat(pluginAssets.cssStrings);
if (options.userCss) cssStrings.push(options.userCss);
const styleHtml = `<style>${cssStrings.join('\n')}</style>`;
const html = `${styleHtml}<div id="rendered-md">${renderedBody}</div>`;
const output = { const output = {
html: html,
pluginAssets: pluginAssets.files.map(f => { pluginAssets: pluginAssets.files.map(f => {
return Object.assign({}, f, { return Object.assign({}, f, {
path: `pluginAssets/${f.name}`, path: `pluginAssets/${f.name}`,
@@ -241,6 +234,19 @@ class MdToHtml {
}), }),
}; };
if (options.bodyOnly) {
output.html = renderedBody;
return output;
}
if (options.userCss) cssStrings.push(options.userCss);
const styleHtml = `<style>${cssStrings.join('\n')}</style>`;
const html = `${styleHtml}<div id="rendered-md">${renderedBody}</div>`;
output.html = html;
// Fow now, we keep only the last entry in the cache // Fow now, we keep only the last entry in the cache
this.cachedOutputs_ = {}; this.cachedOutputs_ = {};
this.cachedOutputs_[cacheKey] = output; this.cachedOutputs_[cacheKey] = output;