Using css styles on the fly

2

I'm sorry about the bad title, I simply don't know how to better phrase my question.

So, the thing is: I have a long Japanese .txt file. Given my current level of Japanese, I need to use a Chromium dictionary extension.

I can open the .txt file in the browser and use the extension, but with no formatting the text is not readable enough. I tried hosting it on a public folder in dropbox and using reformatting tools like Readability or iReader, but both won't work (they don't appear to work on .html pages from my public Dropbox folder either).

I also know about how Chromium lets you edit pages on the fly, and how one can apply custom CSS styles to pages, so I was wondering if it was possible to somehow make the text more readable¹ using such tools. The source text is in a .txt file, but I guess I could convert it to an html page using LibreOffice or something like that, if that's necessary.

So, in a nutshell: how can I display very long (a whole book, in fact) unformatted text in Chromium in a more readable manner?

[1] By readable, I mostly mean bigger fonts and wide margins, pretty much what stuff like Safari's Reader or the iReader extension would do. I obviously do not expect it to know what's a chapter title or anything like that.

P.S.: While I did use the term "CSS", I'm not completely sure that's what I need. If CSS has nothing to do with this, please forgive my ignorance. I know next to nothing about web... stuff.

P.P.S.: While I did talk about iReader to clarify what I need, using iReader itself is not an option since the dictionary extension (Rikaikun) does not like it very much.

vivien

Posted 2012-10-13T11:26:01.160

Reputation: 23

1If you want bigger fonts, can't you just use Ctrl+scroll to zoom in? Every modern browser should support that. Or in Notepad you can go to Format -> Font to increase the font size. – Indrek – 2012-10-13T11:30:18.113

I'd still run into the problem of having no margins, which is specially bad in my 23" widescreen monitor. Sure, I could just resize the browser itself whenever I'm in the mood to read, but I was hoping for a more elegant solution. – vivien – 2012-10-13T11:37:33.813

Answers

2

You could create a HTML document yourself and style it with CSS. The problem with this would be, that you need to find a way to export your data to HTML. You could use LibreOffice, but it most likely generates ugly HTML.

An alternative is using column mode in an editor (example: http://www.ultraedit.com/support/tutorials_power_tips/ultraedit/column_mode.html) and regular expressions to get a HTML document with all your data. In the HTML document you can use CSS to make the document look like you want. Problem here is that you need to know HTML, CSS, regular expressions and you need a good editor.

Alternative simple solution: Couldn't you just paste the text file in Word (or similar) and style it there the way you want?

user150605

Posted 2012-10-13T11:26:01.160

Reputation:

I agree, the simplest solution would be to copy the translated text from chromium and paste it into a full featured text processor like word. – terdon – 2012-10-13T13:12:04.257

I didn't exactly do what you said, but trying to lead me to the path to my solution.

At first I tried just editing it in LibreOffice and saving as html. It kinda worked. So I tried adapting the html based on some pages that looked like what I had in mind. Eventually I just scrapped that and wrote the html/css from scratch via trial and error and copying from my sample page (http://www.allapis.com/Better-Web-Readability-Project-CSS-Library/The-Alchemist.htm).

So, now it works!

While you didn't solve it, your nudge in that direction was very helpful. So thanks a lot!

– vivien – 2012-10-13T15:42:00.187