mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
add HTML header with UTF-8 meta encoding declaration to exported HTML files, fixes #384
This commit is contained in:
parent
580104c4c5
commit
b59c175c2e
@ -20,6 +20,10 @@ async function exportSingleNote(branch, format, res) {
|
|||||||
|
|
||||||
if (note.type === 'text') {
|
if (note.type === 'text') {
|
||||||
if (format === 'html') {
|
if (format === 'html') {
|
||||||
|
if (!note.content.toLowerCase().includes("<html")) {
|
||||||
|
note.content = '<html><head><meta charset="utf-8"></head><body>' + note.content + '</body></html>';
|
||||||
|
}
|
||||||
|
|
||||||
payload = html.prettyPrint(note.content, {indent_size: 2});
|
payload = html.prettyPrint(note.content, {indent_size: 2});
|
||||||
extension = 'html';
|
extension = 'html';
|
||||||
mime = 'text/html';
|
mime = 'text/html';
|
||||||
|
@ -74,11 +74,10 @@ async function exportToTar(branch, format, res) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseFileName = branch.prefix ? (branch.prefix + ' - ' + note.title) : note.title;
|
const baseFileName = sanitize(branch.prefix ? (branch.prefix + ' - ' + note.title) : note.title);
|
||||||
|
|
||||||
if (note.noteId in noteIdToMeta) {
|
if (note.noteId in noteIdToMeta) {
|
||||||
const sanitizedFileName = sanitize(baseFileName + ".clone");
|
const fileName = getUniqueFilename(existingFileNames, baseFileName + ".clone");
|
||||||
const fileName = getUniqueFilename(existingFileNames, sanitizedFileName);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isClone: true,
|
isClone: true,
|
||||||
@ -150,6 +149,10 @@ async function exportToTar(branch, format, res) {
|
|||||||
|
|
||||||
function prepareContent(note, format) {
|
function prepareContent(note, format) {
|
||||||
if (format === 'html') {
|
if (format === 'html') {
|
||||||
|
if (!note.content.toLowerCase().includes("<html")) {
|
||||||
|
note.content = '<html><head><meta charset="utf-8"></head><body>' + note.content + '</body></html>';
|
||||||
|
}
|
||||||
|
|
||||||
return html.prettyPrint(note.content, {indent_size: 2});
|
return html.prettyPrint(note.content, {indent_size: 2});
|
||||||
}
|
}
|
||||||
else if (format === 'markdown') {
|
else if (format === 'markdown') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user