Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib/MarkdownViewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ import { t } from './utils/i18n.js';

// derived from tab manager
let currentFile = $derived(tabManager.activeTab?.path ?? '');
let isMarkdown = $derived(['md', 'markdown', 'mdown', 'mkd'].includes(currentFile.split('.').pop()?.toLowerCase() || ''));
let isMarkdown = $derived(['md', 'markdown', 'mdown', 'mkd', 'txt'].includes(currentFile.split('.').pop()?.toLowerCase() || ''));
let editorLanguage = $derived(getLanguage(currentFile));
let htmlContent = $derived(tabManager.activeTab?.content ?? '');
let sanitizedHtml = $derived(DOMPurify.sanitize(htmlContent));
Expand Down Expand Up @@ -453,7 +453,7 @@ import { t } from './utils/i18n.js';
if (!activeId) return;

const ext = filePath.split('.').pop()?.toLowerCase();
const isMarkdown = ['md', 'markdown', 'mdown', 'mkd'].includes(ext || '');
const isMarkdown = ['md', 'markdown', 'mdown', 'mkd', 'txt'].includes(ext || '');
const tab = tabManager.tabs.find((t) => t.id === activeId);

if (isMarkdown) {
Expand Down Expand Up @@ -1510,7 +1510,7 @@ import { t } from './utils/i18n.js';
if (!rawHref) return;

if (rawHref.startsWith('#')) return;
const isMarkdown = ['.md', '.markdown', '.mdown', '.mkd'].some((ext) => {
const isMarkdown = ['.md', '.markdown', '.mdown', '.mkd', '.txt'].some((ext) => {
const urlNoHash = rawHref.split('#')[0].split('?')[0];
return urlNoHash.toLowerCase().endsWith(ext);
});
Expand Down
12 changes: 6 additions & 6 deletions src/lib/components/TitleBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -190,22 +190,22 @@
if (currentFile) list.push('open_loc');

const ext = currentFile ? currentFile.split('.').pop()?.toLowerCase() || '' : 'md';
const isMarkdown = ['md', 'markdown', 'mdown', 'mkd'].includes(ext);
const isMarkdown = ['md', 'markdown', 'mdown', 'mkd', 'txt'].includes(ext);

if (isMarkdown) {
list.push('toc');
list.push('fullWidth');
if (!tabManager.activeTab?.isSplit) {
if (!isEditing && currentFile) {
list.push('live');
}
list.push('edit');
if (!tabManager.activeTab?.isSplit && !isEditing && currentFile) {
list.push('live');
}
if (tabManager.activeTab?.isSplit) {
list.push('sync');
}
list.push('split');
}
if (isMarkdown && !tabManager.activeTab?.isSplit) {
list.push('edit');
}
list.push('zen');
list.push('tabs');
}
Expand Down
Loading