Something went wrong. Try again.
A local-first note taking app
Something went wrong. Try again.
TypeScript
12345678910111213141516171819202122232425262728293031323334353637/** * Whether a vault file should open in the text/markdown editor. * * Vault editing is text-only for now; binary files (images, etc.) are listed in * the sidebar but not editable (a dedicated viewer is a future addition). */const TEXT_EXTENSIONS = new Set([ 'md', 'markdown', 'mdx', 'txt', 'text', 'json', 'yaml', 'yml', 'toml', 'csv', 'tsv', 'log', 'xml', 'html', 'css', 'js', 'ts', 'tsx', 'jsx',]);
/** True if `path`'s extension is a known text format (or it has no extension). */export function isTextFile(path: string): boolean { const name = path.split('/').pop() ?? path; const dot = name.lastIndexOf('.'); if (dot <= 0) return true; // no extension (or dotfile) → treat as text const ext = name.slice(dot + 1).toLowerCase(); return TEXT_EXTENSIONS.has(ext);}