mirror of
https://github.com/zadam/trilium.git
synced 2025-06-05 17:38:47 +02:00
unify markdown mime to text/x-markdown
This commit is contained in:
parent
4b1cf05c0e
commit
003eed368b
@ -34,7 +34,7 @@ async function exportSingleNote(exportContext, branch, format, res) {
|
||||
const turndownService = new TurndownService();
|
||||
payload = turndownService.turndown(noteContent.content);
|
||||
extension = 'md';
|
||||
mime = 'text/markdown'
|
||||
mime = 'text/x-markdown'
|
||||
}
|
||||
}
|
||||
else if (note.type === 'code') {
|
||||
|
@ -28,6 +28,8 @@ const CODE_MIME_TYPES = {
|
||||
'text/x-kotlin': true,
|
||||
'text/x-stex': true,
|
||||
'text/x-lua': true,
|
||||
// possibly later migrate to text/markdown as primary MIME
|
||||
'text/markdown': 'text/x-markdown',
|
||||
'text/x-markdown': true,
|
||||
'text/x-objectivec': true,
|
||||
'text/x-pascal': true,
|
||||
@ -48,7 +50,7 @@ async function importSingleFile(importContext, file, parentNote) {
|
||||
if (importContext.textImportedAsText) {
|
||||
if (file.mimetype === 'text/html') {
|
||||
return await importHtml(importContext, file, parentNote);
|
||||
} else if (file.mimetype === 'text/markdown') {
|
||||
} else if (['text/markdown', 'text/x-markdown'].includes(file.mimetype)) {
|
||||
return await importMarkdown(importContext, file, parentNote);
|
||||
} else if (file.mimetype === 'text/plain') {
|
||||
return await importPlainText(importContext, file, parentNote);
|
||||
|
@ -133,7 +133,7 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
let type = 'file';
|
||||
|
||||
if (mime) {
|
||||
if (mime === 'text/html' || mime === 'text/markdown') {
|
||||
if (mime === 'text/html' || ['text/markdown', 'text/x-markdown'].includes(mime)) {
|
||||
type = 'text';
|
||||
}
|
||||
else if (mime.startsWith('image/')) {
|
||||
@ -251,7 +251,7 @@ async function importTar(importContext, fileBuffer, importRootNote) {
|
||||
}
|
||||
}
|
||||
|
||||
if ((noteMeta && noteMeta.format === 'markdown') || (!noteMeta && mime === 'text/markdown')) {
|
||||
if ((noteMeta && noteMeta.format === 'markdown') || (!noteMeta && ['text/markdown', 'text/x-markdown'].includes(mime))) {
|
||||
const parsed = mdReader.parse(content);
|
||||
content = mdWriter.render(parsed);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user