Live data from Hacker News

Write HTML Right

lofi.limo

81–90 of 212 posts

Re: Write HTML Right

#81
Thanks to Aaron for posting this. Such a great reminder.

Anyone interested in this subject, check out a series of three very tiny books called “UPGRADE YOUR HTML” by Jens Oliver Meiert.

They give great step-by-step examples for eliminating optional tags and attributes, reducing HTML to its cleanest simplest valid form. The author is a super-expert in this specific subject, working with Google and W3C on this. His bio here: https://meiert.com/en/biography/

From LeanPub: https://leanpub.com/b/upgrade-your-html-123

From Amazon: https://www.amazon.com/gp/product/B08NP4GXY2/

Re: Write HTML Right

#84
post #73

> A few years ago, I found out I'd been tying my shoes wrong for my entire life. I thought laces came undone easily and didn't usually look very good. At least that's how mine were, and I never paid much attention to anyone else's. It took a couple of weeks to re-train my hands but now I have bows in my laces that look good and rarely come undone. I’m equally interested in this as the HTML. Any clue what the author i…

Possibly the Ian knot https://www.fieggen.com/shoelace/ianknot.htm You look goofy trying to relearn to tie your shoes, but it really is fast and sturdy.

It was apparently the square knot, but I'm a big fan of the Ian knot. I learned it about a year ago and at the very least, tying my shoes is more fun now. I'm not yet convinced it's better than the old-school method, but it looks impressive when you do it and it's more fun.

Re: Write HTML Right

#85
post #54

Whilst the spec certainly allows you to ignore closing of a whole range of elements, it's not necessarily the wisest of choices to make. The parser does actually get slower when you fail to close your tags in my experience. Unscientific stats from a recent project where I noticed it: + Document is about 50,000 words in size. About 150 words to a paragraph element, on average. + Converting the entire thing to self-clo…

[deleted]

Re: Write HTML Right

#86
post #5

Regarding writing "one-sentence-per-line", I've noticed that style before in LaTeX. While I don't use that style, one advantage that I like is the ability to include comments on the sentence level in LaTeX. So instead of this: First sentence. Second sentence. % Comment on first sentence. I can write: First sentence. % Comment on first sentence. Second sentence. (Of course, one could define a new TeX macro that doesn'…

I've been working on turning a pretty massive scanned book into a git repo of markdown files, with multiple collaborators. Using sentence-per-line has been useful (compared to line-per-paragraph) because, even with / despite --word-diff , PRs are far more concise, and merge conflicts are more rare. From memory, with paragraph-per-line, I think a series of paragraphs, each changed, even with minor changes, kinda breaks git diff and GitHub diff.

Re: Write HTML Right

#87
post #65

Earlier quoted context omitted.

> For some prettier mark up. But then if you run it through Prettier it'll add all the closing tags for you :)

If you’re running it through a processor, why it just write markdown and call it a day?

Well, one simply formats the source file as you write it. The other requires a infile -> outfile build step that's more complex.

Whether the latter is worth it tends to depend on other things than parse time.

Re: Write HTML Right

#88
post #54

Whilst the spec certainly allows you to ignore closing of a whole range of elements, it's not necessarily the wisest of choices to make. The parser does actually get slower when you fail to close your tags in my experience. Unscientific stats from a recent project where I noticed it: + Document is about 50,000 words in size. About 150 words to a paragraph element, on average. + Converting the entire thing to self-clo…

Are more strict html parsers/renderers, and aren't they faster?

Re: Write HTML Right

#89
I'm curious if a more strict html parser would actually be faster.

Browsers are not really fast on my Android, and I wish they were fast.

Re: Write HTML Right

#90
post #23
post #19

Earlier quoted context omitted.

I feel like this style just makes it harder to read and understand the HTML. But hey, if it works for you, great.

This is the output of an app/templating system, i.e. not a single HTML page. Have you ever read the HTML of any dynamically generated page? It's unreadable.

All the HTML code in the app I maintain is pretty readable. At some point of complexity any HTML is difficult to parse, but if I hand-wrote a page in my app I think the HTML would be largely the same.
Post reply on HN