Hacker News new | past | comments | ask | show | jobs | submit login

Something I've experimented with is web templating systems that are HTML 5 native, that is, you parse documents to the DOM, process them in the DOM, then serialize them to the disk (like Hugo) or the web browser.

For instance the "template" of your web site might be an HTML document that has something like

   <div id="content"/>
in the middle of it. The content is in another HTML document, there is some logic that merges the document <head>(s), and the contents of the <body> of the content goes into the above <div>.

It's not that hard but I think it's never caught on for a few reasons.

One of them is that DOM parsing and unparsing is an order of magnitude or two slower than text-based templating sytems. I guess you could parse the template once and cache it but it's still going to be slow.

Another is that you run into "hygenic macro" problems if you want to merge random DOM trees into each other: for instance you could have multiple elements with the same id, the same classes used for different meanings in some other places. You need some answer to this if you want to make something scalable (e.g. the whole point of this exercise is that you should be able to transclude HTML + CSS from anywhere and have it "just work")

Finally it would be really nice to have a reliable WYSIWYG HTML editor, particularly one that would help you use CSS classes in a disciplined way to customize the system to add whatever markup features you want for your site.

It doesn't exist and I wonder why. Every HTML editor I've seen is just garbage. Latency for typing characters is several round trips to the moon. Navigation, selection, where characters appear when I type all seem to be random, like my computer is possessed by the devil.

(It's a general problem w/ most WYSIWYG editors that look like MS Word, including MS Word. I'm sure there is something conceptually wrong with the model which is why all those editors are buggy, but it seems everybody else thinks it is OK for selection, navigation and where you type characters to be random.)




I use something like this for my personal website.

I don't know how fast text-based template systems are, but I can do a clean build of my entire website in under half a second. That seems pretty fast to me. I've been adding content to it for over 20 years now... it's not a massive site since it's just me, but it's not exactly small either.

Every page is authored as HTML, with some extra headers at the top. It's parsed as HTML5. The processor will apply templates in a fairly simple way... merge everything in <head>, merge everything in <body>. There's a special tag for templates that means "put the <body> here, instead of merging".

Any given piece of HTML will be parsed / unparsed only twice, because the templates work on DOM manipulation. The second parse / unparse is there because I use an HTML minifier, and the HTML minifier has a bytes in/bytes out interface.

> Another is that you run into "hygenic macro" problems if you want to merge random DOM trees into each other:...

This is a beast of a problem. If I need an ID in a template that may get used in multiple places, then there's some piece of code somewhere generating the ID.

My experience is that it really becomes a problem when you have large, large sites with tons of people working on them, and it's not a problem at all for one person.

> Finally it would be really nice to have a reliable WYSIWYG HTML editor, particularly one that would help you use CSS classes in a disciplined way to customize the system to add whatever markup features you want for your site.

It's called "Dreamweaver". Truly one of the most powerful web authoring tools ever made.


I want to like Dreamweaver but on a desktop replacement laptop it takes several seconds for characters to appear when I type.

Selection, where the cursor ends up when I click on something and where the cursor goes when I hit the arrow keys are all erratic enough to make me wonder if my computer is possessed by the devil.

I've submitted so many tickets to Adobe about strange problems with Dreamweaver that it's a wonder I haven't been hellbanned from their issue tracker.


All my experience with Dreamweaver is many years out of date. I don't doubt that it's become slow.


The problem is browsers don’t render like a word processor, so it’s hard to fit the model to reality.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: