Lurker News
Hello HN, I hope it will posted as well. I made a note in single html file. This does not require a separate membership or installation of the software, and if you download and modify an empty file, you can modify and read it at any time, regardless of online or offline. It can be shared through messengers such as Telegram, so it is also suitable to share contents with long articles and images. It is also possible to host and blog because it is static html file content.

Comments (143) 59 threads

hliyan5 replies#
Much of the heavy lifting is done by this simple but powerful attribute, something surprisingly few developers seem to know about. It's been around for quite a while.

shashanoid2 replies#
I love this. Once made a pdf editor by converting a doc to HTML then throwing in contenteditable="true" in the top-most div lol
eps#
I had the same bright idea, but it doesn't work Firefox.

Turns out that it creates two representations of the PDF content - one is text, which has 0 opacity and another is prerendered image of the same layered on top of it. The latter is what's displayed. So while you can enable contenteditable and get the editing cursor, no changes you make will be shown. Oh, well.

vhantz#
What do/did you use to convert pdf to html?
noduerme1 reply#
Yeah, it's pretty amazing. Back in 2016 I was still doing a lot of custom sites for small/mid businesses, and realized that almost all of this could be done with WP or something except (1) WP styling is really annoying and I don't want to maintain that, (2) I didn't want to rely on plugin functionality and upgrading WP, and (3) I wanted people with different levels of access to be able to edit different parts of the same page, which is basically impossible in most CMSs. So I basically wrote a CMS from scratch that relied on nothing but contenteditable and TinyMCE, and handed those tags to the appropriate portions (with back-end checks on what people could or could not edit before it was committed, obviously). But the point is, once a client (or their employees) are logged in, they get the right to edit the portions of their own pages that they have credentials for. The CMS puts a nice little dashed border around the parts they can edit, and all of their fonts and colors are saved in TinyMCE preferences so they don't need to hunt around or muck with any HTML (although they can, if they want to).

This ends up feeling rather magical to the clients, because they don't need to go to an editing page to make changes before seeing what it will look like. They just literally edit the content in place on the page, and hit save to deploy it live.
Most of these sites are still in operation after 5-10 years and require almost zero maintenance on my end.

swiftcoder2 replies#
In about 2009, the university I worked at adopted one of those enterprise CMS thingamajigs, but this one was called RedDot, and the central UX conceit was a red dot next to every piece of content, which transformed it into an edit control when clicked...

Under the hood it was about as shit as every other enterprise CMS of the era, but our users fucking loved it.

connorgurney#
Ah, RedDot - that’s a throwback if I ever heard one!
noduerme#
Hah. Never heard of that, but I can see how it would be a total love-fest for users.

Most small site owners, such as remain these days - restuarants, small companies selling furniture, lawyers, whatever - they already have their third party sales platforms. They just want to be able to edit their own web content from time to time, without any learning curve.
I never tried to commercialize my CMS, it wouldn't even make sense to do so, since it's geared toward people who want to pay $200/year for hosting once their site is up and running. (I did charge them well for building, though). But the whole thing is maybe literally 5000 lines of PHP code and a few hundred lines of Javascript and CSS. It's just structured very cleverly to read/write pages in mysql, and it has a few bells and whistles like drag/drop photo uploading in place. Barely competent PHP coders could (and have) adapted it to their own needs after I left clients. One really doesn't need the bloated structure of WP to do this stuff, just a very skeletal frame.
A couple remaining examples of my CMS in action: https://thebarkerlounge.com https://vickmanassociates.com

rad_gruchalski#
Reads like “oh, here’s this amazing thing, it’s called the wheel and the it’s been around for quite a while”. I’m pretty certain I’ve been working with this 20 years ago.

ContentEditable first introduced in ie 5.5 in 2000, available in all major browsers in 2007.

snewman2 replies#
This one line was like 90% of the original implementation of Writely (the startup that became Google Docs; source: I was one of the founders).

The other 90% was all the backend code we had to write to properly synchronize edits across different browsers, each with their own bizarre suite of bugs in their contenteditable implementations :-)

Imustaskforhelp1 reply#
This is a truly a great insight from how simple things can create industry giants like google docs.

I believe that a lot of problems can be converted into synchronization problems in browsers.
Are there any general synchronization libraries / applications that you suggest within browser / outside browser?
Thanks in advance.

pkage3 replies#
Not OP, but common solutions in this space represent the state as conflict-free replicated data types (CRDTs). Some popular browser-based libraries for that are Y.js[0] and Automerge[1].

[0]: https://yjs.dev/ [1]: https://automerge.org/

Continue this thread — 3 replies

nashashmi1 reply#
I thought it was a dynamic text box souped up with all sorts of tricks and semantics to make it appear like a rich text editor
snewman1 reply#
I'm not sure exactly what you mean by "dynamic text box" but it was just a contenteditable div. There have been at least two complete rewrites since I was involved, nowadays I believe it's a canvas with all of the editing, formatting, layout, and rendering done "by hand" in JavaScript.

Continue this thread — 1 reply

godot2 replies#
I like it a lot, and I see from the source you're coding in vanilla js, which is awesome. It's underrated how much of an interactive web app you can build without using any libraries or frameworks nowadays.

I actually also really like the idea of building simple/local web apps in a single HTML page. A while ago my child and I visited a science museum and played with a simple stop motion animator. I decided to make a web app just like it and built it as a single HTML page, copied it to her laptop and she can use it without internet. I built it using React and a bundler though, because I'm too lazy to write vanilla js. It just bundles into a single HTML file. Maybe I'll post a Show HN some time.

kristopolous1 reply#
really, just like we had a "you don't need jquery for that" we need a "you don't need react (or vue, or svelte, or whatever else you are thinking) for that."

plain, vanilla js and some decent skills will do nearly almost everything in a cleaner and more maintainable way.
after decades of maintaining other people's stuff, dumb design by smart people beats all the other combinations.

johnecheck2 replies#
The downside, of course, is needing to code in JavaScript.
jasonjmcghee#
As opposed to? You can use typescript and compile too. And/or still bundle with esbuild
kristopolous#
Just learn it right. I'm tired of people fighting it because they think they can learn it by intuition and then create monstrosities that are easily solved by the language they refused to understand properly in the first place.
memhole#
I like this about quarto. You can create a standalone html file and share with people.
cxr1 reply#
Great work.

Consider changing the behavior so that when the page is opened in the browser from the local disk, then it opens edit mode automatically, but when it's published to someone's website and accessed on the open web (check if the address is http/https), then it's a normal, read-only view expected from most pages.
Of course:
1. there should be a way to override this (a query string param or magic URL fragment) so you can look at it in edit mode, too
2. there should be a blanket exception for certain domains/URL prefixes—defaulting to keepworking.github.io (or <https://keepworking.github.io/nash/>)—so it activates edit mode on that site, too, which means that you personally don't have to do anything special to make the demo work (best if this exception is user-modifiable, so e.g. someone else can get the same behavior if they want without using the trick from #1)

zaphod4202 replies#
I actually really like the idea of websites that allow you to edit the content and save it locally... IMO, this is brilliant and should stay as is.
dotancohen#
This was actually the intent of some early versions of the WWW.
cxr#
You're not really grokking either my comment or how the existing read-only mode actually works right now.
Alive-in-2025#
Yes, please make it offer to save a file. That gets us much closer to the capability of having private bookmarks if we want to

Load more comments