1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Clipper: Minor fixes

This commit is contained in:
Laurent Cozic 2019-07-15 01:17:17 +01:00
parent 74ee629266
commit c75618eb8f
2 changed files with 4 additions and 1 deletions

View File

@ -52,6 +52,7 @@ const htmlUtils = {
for (const anchor of anchors) {
const href = anchor.getAttribute('href');
if (!href) continue;
const newHref = urlUtils.prependBaseUrl(href, baseUrl);
anchor.setAttribute('href', newHref);
}

View File

@ -437,9 +437,10 @@ class Api {
if (requestNote.body_html) {
if (requestNote.convert_to === 'html') {
const style = await this.buildNoteStyleSheet_(requestNote.stylesheets);
const minify = require('html-minifier').minify;
const styleTag = style.length ? '<style>' + style.join('\n') + '</style>' + '\n' : '';
const minify = require('html-minifier').minify;
output.body = minify(styleTag + requestNote.body_html, {
// Remove all spaces and, especially, newlines from tag attributes, as that would
// break the rendering.
@ -447,6 +448,7 @@ class Api {
// Need to remove all whitespaces because whitespace at a beginning of a line
// means a code block in Markdown.
collapseWhitespace: true,
minifyCSS: true,
});
output.body = htmlUtils.prependBaseUrl(output.body, baseUrl);
output.markup_language = Note.MARKUP_LANGUAGE_HTML;