Disable code highlighting for large files

This commit is contained in:
2023-01-11 20:28:08 +01:00
parent 31c170872f
commit c075cb4a72

View File

@@ -10,7 +10,9 @@ export const set_file = file => {
if (file.name.endsWith(".md") || file.name.endsWith(".markdown") || file.mime_type === "text/demo") { if (file.name.endsWith(".md") || file.name.endsWith(".markdown") || file.mime_type === "text/demo") {
markdown(file) markdown(file)
} else if (file.name.endsWith(".txt")) { } else if (file.name.endsWith(".txt") || file.size > 524288) {
// If the file is larger than 512KiB we do not enable code highlighting
// because it's too slow
text(file) text(file)
} else { } else {
code(file) code(file)