News for hackers. Stuff that matters.
Re:Writing HTML by Hand by MrVandemar on Wednesday September 20, 2023 @03:32AM (#37581447)
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 noticed that I was using it. It seems like an unconscious decision, like a river flowing downhill, finding its own path.

Most used tag would be <p>, because I write a lot of essays and things with paragraphing. As well as other structural elements such as headings and lists, I lean into <time>, <cite>, <abbr> a lot.

I tend to use the 'optional' form. I don't close <p>'s and <li>'s unless required.

Re:Writing HTML by Hand by the_gipsy on Wednesday September 20, 2023 @03:49AM (#37581553)
I really love Elm's way of writing html. It's like writing html without closing tags, just indentation.
Re:Writing HTML by Hand by rudasn on Wednesday September 20, 2023 @08:35AM (#37583369)
Check out haml. Quite similar approach I think.
Re:Writing HTML by Hand by nikolaplejic on Wednesday September 20, 2023 @08:50AM (#37583503)
Not equivalent, but arguably more useful for manual authoring: Emmet [0] was all the range a while back, and I still use it to write HTML. It comes naturally if you're used to writing CSS-like selectors, and mostly gets out of the way.

DSL-wise, I've rather enjoyed Clojure's Hiccup [1].

[0] https://emmet.io/

[1] https://github.com/weavejester/hiccup

Re:Writing HTML by Hand by naniwaduni on Wednesday September 20, 2023 @10:59AM (#37585045)
When writing html for documents and not as code, indenting everything really lost its luster to me, it's really nice to have the content root flush with the left margin.
Re:Writing HTML by Hand by Akronymus on Wednesday September 20, 2023 @11:14AM (#37585251)
For me personally, elmish offers even better usability. But thats probably down to simple familiarity.
Re:Writing HTML by Hand by pests on Wednesday September 20, 2023 @04:00AM (#37581638)
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. <td> for example obviously ends when you come across another <td>, another <tr>, or the required </table>

Re:Writing HTML by Hand by pbhjpbhj on Wednesday September 20, 2023 @05:10AM (#37582086)
><td> for example obviously ends when you come across another <td>, another <tr>, or the required </table> //

Only a madman would nest tables!!

/me crying in 2000's web design.

Re:Writing HTML by Hand by pests on Wednesday September 20, 2023 @07:24PM (#37591377)
Nope, nesting works! The required ending tag on table means any nested table will open a new context and then any <tr> or <td> will now scope to that table and will until the second tables closing </table>.

  <table>
  <tr>
  <td>
    <table>
    <tr>
    <td> table-cell-inside-table
    </table>
  </table>
Re:Writing HTML by Hand by MrVandemar on Wednesday September 20, 2023 @06:16AM (#37582454)
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 <br/> 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 by foobarbecue on Wednesday September 20, 2023 @08:24AM (#37583298)
You mean </br>, presumably.
Re:Writing HTML by Hand by throwaway_no on Wednesday September 20, 2023 @08:30AM (#37583334)
<br /> is a self closing tag. This is used in XML / XHTML for elements that have no contents.

It is a valid short form of <br></br>

Re:Writing HTML by Hand by thinkingemote on Wednesday September 20, 2023 @08:35AM (#37583368)
technically <br></br> is not allowed to have an end tag in the HTML spec

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br

so it should be <br> on its own or <br />

Re:Writing HTML by Hand by naniwaduni on Wednesday September 20, 2023 @11:03AM (#37585110)
A silly corner of the spec, considering that this is a spec that specifies exactly how to handle e.g. misnested elements and admits plenty of other things that read intuitively as standardized sloppiness.
Re:Writing HTML by Hand by midasuni on Wednesday September 20, 2023 @08:30AM (#37583336)
No. <br></br> is shortened to <br/>
Re:Writing HTML by Hand by foobarbecue on Wednesday September 20, 2023 @11:29AM (#37585445)
Wow, thanks everyone... it seems I've misunderstood this all these years.
Re:Writing HTML by Hand by pests on Wednesday September 20, 2023 @07:20PM (#37591354)
You see this a lot in React/JSX too. Saves seme typing and noise inserting a component with no children.
Re:Writing HTML by Hand by brainzap on Wednesday September 20, 2023 @06:22AM (#37582492)
but how do you do images or video, they need some extra magic work
Re:Writing HTML by Hand by MrVandemar on Wednesday September 20, 2023 @07:27AM (#37582870)
I'm not sure I understand your question. <img> is the tag you use for an image, and there are tags to embed video.
Re:Writing HTML by Hand by brettermeier on Wednesday September 20, 2023 @08:10AM (#37583203)
Yes, it's really simple. And if he meant sizing, "height" and "width" parameters still work in an img-tag:

<img src="img.png" height="100px">

(also the other parameter is set to "auto" automatically, at least in Firefox)

Re:Writing HTML by Hand by erhaetherth on Thursday September 21, 2023 @03:00AM (#37594104)
pretty sure you're not supposed to use px in the height attribute. they are pixels.

the width will be set to match the aspect ratio but your browser will have to DL the image first. which probably doesn't matter unless you have content to the left/right of it, then it'll get bumped when the image loads. layout shift is a nasty thing.

Re:Writing HTML by Hand by brettermeier on Thursday September 21, 2023 @06:25AM (#37595664)
But you can do it and it works. And because it's about taking quick notes, it's not really about the beauty of the layout or layout shifts, isn't it?
Re:Writing HTML by Hand by kome on Wednesday September 20, 2023 @08:37AM (#37583386)
<img>? <video>?

but i'm not sure if i understand the question...

Re:Writing HTML by Hand by GoblinSlayer on Wednesday September 20, 2023 @11:50AM (#37585726)
In web 2.0 everything is done by javascript.
Re:Writing HTML by Hand by SPBS on Wednesday September 20, 2023 @08:28AM (#37583318)
<a href="">links</a> are such a pain to write though. Probably the biggest annoyance when I write in raw html.
Re:Writing HTML by Hand by adrianmsmith on Wednesday September 20, 2023 @08:34AM (#37583364)
But is [abc](http://...) any better? I can never remember which brackets to use, and I've been using Markdown for years now. I never have a problem remembering the HTML syntax.
Re:Writing HTML by Hand by alanbernstein on Wednesday September 20, 2023 @08:42AM (#37583427)
IMO, yes, it is so much more concise that it is worth memorizing.

https://mtsknn.fi/blog/how-to-remember-markdowns-link-syntax...

Think of it as a function call (mnemonically, it doesn't need to make sense conceptually).

Re:Writing HTML by Hand by fabianholzer on Wednesday September 20, 2023 @05:16PM (#37590291)
My problem exactly. My memory seems not to work well for symbols which rely mostly on position. Is it URL first or link text first, and do I put the URL in round or square brackets? Same with formatting: Is the first * italics or bold? I can remember <i> and <b> much better, and will trade off a bit of verbosity for not straining my memory anytime.
Re:Writing HTML by Hand by umpalumpaaa on Wednesday September 20, 2023 @07:46PM (#37591560)
Easy trick to remember it: [Button](url)

The [ and ] are ascii art for a button - in between goes what is clickable (title) and then comes the url.

Re:Writing HTML by Hand by MrVandemar on Thursday September 21, 2023 @04:16AM (#37594684)
The lack of internal consistency, especially the link syntax, has always been something I struggled with with Markdown. But that's about the first sensible way to remember it that I've seen.
Re:Writing HTML by Hand by jasonm23 on Thursday September 21, 2023 @03:53AM (#37594498)
yes of course.

> I can never remember which brackets to use

and that is patently untrue, as you just demonstrated.

Re:Writing HTML by Hand by adrianmsmith on Thursday September 21, 2023 @04:41AM (#37594871)
I had to look it up before writing my comment :)
Re:Writing HTML by Hand by theandrewbailey on Wednesday September 20, 2023 @09:30AM (#37583878)
10 years ago, I got frustrated adding in all the closing tags for my blog's articles, so I implemented Markdown. It made writing long articles so much easier that I wouldn't dare go back and wonder why I waited so long to do it.
Re:Writing HTML by Hand by lenkite on Thursday September 21, 2023 @03:59PM (#37603390)
How do you create TOC ? Navigation bars ?
Re:Writing HTML by Hand by MrVandemar on Thursday September 21, 2023 @06:08PM (#37605085)
There's a difference between a web-site and a document. When you fire up a word-processor do you produce a document with "navigation bars".

As for TOC, I've never written anything that strictly needs one. I do have "hxtoc" on my laptop, but I've never needed it.

I do publish some of my writing to my website, and I discuss the minimal tooling I use here: https://brett.coulstock.id.au/site-colophon.html