Studying Papyrix's support for rendering Markdown ebooks...
Its Markdown Provider subclass opens such files by closing any existing file if any, constructs a new Markdown object & remembers it, defers to its load() method, clears its metadata properties, copies the title over, zeroes out the author, copies the cached path over, copies the cover path over, sets initial page data.
To compute a page count it estimates that the screen can fit 2KiB of text, same as for plaintext.
1/2 for today?
A support library, among other things, provides a Markdown class whose constructor concatenates together a cache's directory path, & extracts the file's basename to be its title.
The load method carefully opens the file from the SD card, retrieves file's size, closes the file, & invokes a helper to extract the file's title.
To clear its cache it removes that directory if it exists. And there's a corresponding method to create the directory if it doesn't. A 3rd returns cover.bmp from the cache.