Live data from Hacker News

Writing HTML by hand

simblob.blogspot.com

21–30 of 76 posts

Re: Writing HTML by hand

#21

is interesting there: it’s an SVG element. SVG and MathML are fun in HTML syntax, because it becomes a little more XMLly when parsing them: XML-style self-closing tags ( ) actually work , and there’s no such thing as a void element (e.g. which has no closing tag because it has no contents). This can lead to fun problems in overly-simplistic filtering, e.g. alert() is a syntax error in SVG or in XML-syntax HTML, is sw…

Yeah the trailing slash cargo cult just goes to show the author has no idea what he/she is doing. Even more pointless is a pretentious space before the slash. It appears many extant uses of the bogus slash result from WordPress filters and their fragile nature (never change a running WP system aka WP trainwrecks) rather than manual insertion.

> Even more pointless is a pretentious space before the slash

It could also be an habit, and not really a harmful one. You can argue against it with convincing arguments, but in the end, there's nothing fundamentally wrong with it. It's understood by the parser.

The space before the slash once was advised for compatibility with old browsers when writing polyglot html. Some old browsers would not understand the slash, but this would not be an issue with a space. This is mostly irrelevant today but habits stick.

And with the gotcha exposed by my sibling comment, maybe it's better to stick with the space after all when using the slash. And I can see how wanting to explicitly close the tag is compelling, even if it has its drawbacks.

Re: Writing HTML by hand

#22
post #2

I write HTML by hand and one thing that's come in handy is HTML's built-in functionality for author-defined custom elements. We use ICON-LIST which wraps a UL and optionally an SVG if you don't want to use the default checkmark, and STAR-RATING which displays a rating out of 5 SVG stars. They aren't my most-used, that's probably P or A or LI or DIV or SPAN by number, but they're some of the most important I use frequ…

Are you talking about web components?

Web Components are generally considered to be a set of standards, and Custom Elements is one of them. The others are Shadow DOM and HTML Templates (the element).

Re: Writing HTML by hand

#23
post #16

HTML is how I write . I struggled with Markdown (and various other mark up formats) for a long time, until I realised that, for me, nothing beats plain HTML for simplicity and expressive power. I now use HTML the way people generally use markdown: as an open, easy to read, easy to write, plain-text format for taking notes, writing articles, expressing thoughts, and so on. I didn't really choose HTML, I just sort of n…

The optional form is weird looking coming from the XHTML era where we were trained on the auto-closing form. Looking up elements that support no closing tag: html, head, body, p, li, dt, dd, option, thead, th, tbody, tr, td, tfoot, colgroup Makes sense if you think about it. Basically everything is pretty well defined and its obvious what next tag should close the context. for example obviously ends when you come acr…

I lived through the XHTML era; when I was doing web-design I adopted it for many projects. It just seemed right to rigorously enforce a formal approach, and I suspect it reduced errors.

Took me a long time to train myself out of
afterwards though.

But the optional-style works I think for writing. Especially if you're just writing a document. If you don't have site-menus, a search bar, social-media sharing icons, javascript libraries and all the other paraphenalia and page-furniture of a website, then you are left with a lean and structured file.

Re: Writing HTML by hand

#24

HTML is how I write . I struggled with Markdown (and various other mark up formats) for a long time, until I realised that, for me, nothing beats plain HTML for simplicity and expressive power. I now use HTML the way people generally use markdown: as an open, easy to read, easy to write, plain-text format for taking notes, writing articles, expressing thoughts, and so on. I didn't really choose HTML, I just sort of n…

but how do you do images or video, they need some extra magic work

Re: Writing HTML by hand

#25
I hate writing HTML. Yes, there's IDE support for inserting s but it's just annoying. Same for lists of classes or attributes etc.

For everyone else feeling like me: Try pug (formerly jade) or rather it's CLI variant pug-cli. You can reuse stuff and even have JS in it to iterate through things or give it parameters, all while still feeling pretty vanilla.

https://pugjs.org/api/getting-started.html

Re: Writing HTML by hand

#27
post #17

I don't exactly write "HTML" by hand if by HTML one means (as seems to be implied in the article) long text documents with HTML tags in it. For that I use markdown because it's faster and much easier to read. But I do write HTML templates by hand when I code webapps; it's cleaner and more efficient than use some kind of library. I tend to use DIVs with custom data- attributes; I don't know if it's a good or bad pract…

>I also code SVGs by hand and it's surprisingly easy and straightforward; most (not all, but most) drawings can be approximated by combining elementary shapes (instead of paths).

Interesting. Do you have any examples of thise approximations?

Re: Writing HTML by hand

#29

HTML is how I write . I struggled with Markdown (and various other mark up formats) for a long time, until I realised that, for me, nothing beats plain HTML for simplicity and expressive power. I now use HTML the way people generally use markdown: as an open, easy to read, easy to write, plain-text format for taking notes, writing articles, expressing thoughts, and so on. I didn't really choose HTML, I just sort of n…

but how do you do images or video, they need some extra magic work

I'm not sure I understand your question. is the tag you use for an image, and there are tags to embed video.

Re: Writing HTML by hand

#30

For many purposes it is needlessly verbose to write html by hand. Thats why markdown became popular. But if more people do it and report their usage patterns one could maybe create a "super-markdown", i.e., the closest you could get to mapping html flexibility without the annoying XML verbosity.

Arguably, org-mode provides a "better markdown", but it's decidedly more niche.
Post reply on HN