For a list of BASHing data 2 blog posts see the index page.
The browser-as-text-editor trick
Ten years ago an article in PC World explained how you could add text to a blank webpage. That's not the same as using an online text editor, because the editable text is local to your browser.
In a modification of the styling demonstrated in 2014, I put the code
data:text/html, <body contenteditable style="font: 16px monospace;max-width:900px;margin:10px left;padding:50px;">
into the address bar above a new, blank tab and pressed Enter. Clicking anywhere on the blank webpage, I started typing in some text. I also bookmarked the blank page for future use:
Once I've typed something, I can save the text somewhere in my file system as a text file (not as an HTML file), using the browser's "Save" function (Ctrl + s). (When I close the "text tab", the text I've entered isn't saved by the browser.)
But there's more... I can open a text file in my system in a browser tab, then copy all its text into the "text tab", edit the text there and re-save the text in its original location. This turns the browser into a minimal but genuine text editor. My Firefox browser even does spell-checking:
Other text-editor-type functions that work in a "text tab" are clicking to select individual words, individual lines or individual paragraphs, plus the expected operations of the Home, End, Delete and Page Up/Down keys.
I can also copy text from webpages or PDFs on other tabs and paste the unformatted text into my "text tab", then save the result as a text file. This means I don't need to open a dedicated text editor to do a copy/paste/save — it all happens in my browser.
A handy trick!
Next post:
2025-01-03 Replace the last N occurrences of a pattern in a string
Last update: 2024-12-27
The blog posts on this website are licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License