Thread: Markdown?
View Single Post
Old 12-04-2020, 05:15 AM   #5
pazos
cosiņeiro
pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.pazos ought to be getting tired of karma fortunes by now.
 
Posts: 1,406
Karma: 2451781
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by sbaguz View Post
Thanks, I will test it.
But, as far as I understand, it's a true converter. I mean: somewhere I will find a xxx.html file generated from my stored xxx.md file. Correct?
You're correct

Quote:
Originally Posted by sbaguz View Post
I was thinking about something working under the hood and simply rendering the original file without creating a new one (or at least in a temporary way only).
That's actually more involved

Each type of document can be opened with one or more "viewers". I'm quoting viewers because they can be whatever, from simple things built on top of available widgets (like htmlboxwidget.lua) to wrappers to full engine backends like crengine, mupdf or djvulibre.

"Viewers" share in common that they need to be added to a documentRegistry, so the program knows which type of files a given viewer supports.

In the case of markdown files, there're currently 2 "viewers": CREngine and the text editor plugin (see attachments).

You can wrap you own widget based on htmlboxwidget and handle md documents with it. In that case you can do conversion on the fly, without storing the html in a cache file. That should work for little files, but don't expect to convert the Bible in a Kobo Mini on the fly.

My suggestion, if you go that route, is checking the file size of the document you want to render, doing on the fly conversion until a certain size and using a cache file for larger documents.

Anyways, you can look at the code in https://github.com/koreader/koreader...ntend/document

Have fun
Attached Thumbnails
Click image for larger version

Name:	Sin nombre.png
Views:	223
Size:	49.9 KB
ID:	183768  
pazos is offline   Reply With Quote