From 991b6b5a01c7360f1fd852fc0cc5419950187a2a Mon Sep 17 00:00:00 2001 From: cottongin Date: Tue, 27 Jan 2026 07:32:59 -0500 Subject: [PATCH] feat: treat .md files as .txt (#498) Cherry-picked from upstream PR #498 --- src/activities/home/MyLibraryActivity.cpp | 3 ++- src/activities/reader/ReaderActivity.cpp | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/activities/home/MyLibraryActivity.cpp b/src/activities/home/MyLibraryActivity.cpp index 513d15b..9e9f52b 100644 --- a/src/activities/home/MyLibraryActivity.cpp +++ b/src/activities/home/MyLibraryActivity.cpp @@ -136,7 +136,8 @@ void MyLibraryActivity::loadFiles() { } else { auto filename = std::string(name); if (StringUtils::checkFileExtension(filename, ".epub") || StringUtils::checkFileExtension(filename, ".xtch") || - StringUtils::checkFileExtension(filename, ".xtc") || StringUtils::checkFileExtension(filename, ".txt")) { + StringUtils::checkFileExtension(filename, ".xtc") || StringUtils::checkFileExtension(filename, ".txt") || + StringUtils::checkFileExtension(filename, ".md")) { files.emplace_back(filename); } } diff --git a/src/activities/reader/ReaderActivity.cpp b/src/activities/reader/ReaderActivity.cpp index 14d6623..04240b3 100644 --- a/src/activities/reader/ReaderActivity.cpp +++ b/src/activities/reader/ReaderActivity.cpp @@ -22,9 +22,8 @@ bool ReaderActivity::isXtcFile(const std::string& path) { } bool ReaderActivity::isTxtFile(const std::string& path) { - if (path.length() < 4) return false; - std::string ext4 = path.substr(path.length() - 4); - return ext4 == ".txt" || ext4 == ".TXT"; + return StringUtils::checkFileExtension(path, ".txt") || + StringUtils::checkFileExtension(path, ".md"); // Treat .md as txt files (until we have a markdown reader) } std::unique_ptr ReaderActivity::loadEpub(const std::string& path) {