Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > KOReader

Notices

Reply
 
Thread Tools Search this Thread
Old 12-02-2020, 04:07 AM   #1
sbaguz
Member
sbaguz began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jan 2017
Device: Kobo Aura One
Question Markdown?

I was thinking about it while using a Notepad++ plugin which renders a markdown file directly in html: it would be great to have the same in Koreader! I mean a plugin which opens a .md file as a fully rendered .html. This way I could store a lot of small size files but read them in an elegant way... And even edit them!
Would it be possible and of interest?
sbaguz is offline   Reply With Quote
Old 12-02-2020, 07:56 AM   #2
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,271
Karma: 2200049
Join Date: Apr 2014
Device: BQ Cervantes 4
Quote:
Originally Posted by sbaguz View Post
I was thinking about it while using a Notepad++ plugin which renders a markdown file directly in html: it would be great to have the same in Koreader! I mean a plugin which opens a .md file as a fully rendered .html. This way I could store a lot of small size files but read them in an elegant way... And even edit them!
Would it be possible and of interest?
md to html is already supported (see attachments).

Works fine for little files with local images, etc but cannot fetch remote resources and is a tad slow for huge files. It is also a single file md2html converter.

Enhancements welcome
Attached Thumbnails
Click image for larger version

Name:	Captura de pantalla 2020-12-02 a las 13.48.35.png
Views:	286
Size:	135.9 KB
ID:	183740   Click image for larger version

Name:	Captura de pantalla 2020-12-02 a las 13.48.47.png
Views:	261
Size:	115.7 KB
ID:	183741  
pazos is offline   Reply With Quote
Old 12-02-2020, 10:54 AM   #3
Frenzie
Wizard
Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.Frenzie ought to be getting tired of karma fortunes by now.
 
Posts: 1,619
Karma: 724945
Join Date: Oct 2014
Location: Antwerp
Device: Kobo Aura H2O
It's a touch proof of concept-ish but it works well enough for my purposes (i.e., mainly the Quickstart Guide).
Frenzie is online now   Reply With Quote
Old 12-04-2020, 04:13 AM   #4
sbaguz
Member
sbaguz began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jan 2017
Device: Kobo Aura One
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?
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).
sbaguz is offline   Reply With Quote
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,271
Karma: 2200049
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:	159
Size:	49.9 KB
ID:	183768  
pazos is offline   Reply With Quote
Old 12-11-2020, 05:28 AM   #6
sbaguz
Member
sbaguz began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jan 2017
Device: Kobo Aura One
Thanks for the explanations!
I will give a look at the code.
sbaguz is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
markdown-calibre signum Calibre 8 12-31-2014 07:25 PM
Multimarkdown instead of markdown anywho Calibre 15 08-13-2013 09:20 PM
markdown-calibre bobb40 Conversion 1 07-08-2011 12:02 PM
->Txt+Markdown Perkin Calibre 2 12-11-2010 04:04 AM
Markdown editor user_none Workshop 0 08-30-2009 09:25 PM


All times are GMT -4. The time now is 06:20 PM.


MobileRead.com is a privately owned, operated and funded community.