by blakewatson on 1/12/24, 3:07 AM with 68 comments
by jdthedisciple on 1/14/24, 6:08 PM
<html>
<body>
# Blog Post Title
<br>
Welcome to this simple blog post
</body>
<js>
document.body.innerHTML = document.body.innerHTML.split('<br>').map((line) => line.trim().startsWith('# ') ? `<h1>${line}</h1>` : `<p>${line.split('# ')[1]}</p>`).join(''); // add more md features here if desired
<js/>
</html>
(replace js with script, which i cant write here on hn apparently)Obviously move the JavaScript to its own file and embed it to avoid repetition across blog entries. Plus, move it into 'DOMContentLoaded' event handler to be safe.
Could it get any more elegant and beautiful?
by jrm4 on 1/14/24, 7:05 PM
It's borderline bizarre to have watched this method of doing things kind of die out, and then also come back in the form of "static site generators" -- which, frankly, are still way clunkier than this.
Write in Zim, export to html, rsync to site. Easy.
by gerikson on 1/14/24, 5:23 PM
Also, I don't want to dump on this dude but I've authored literally hundreds of entries on my 2 blogs since 2019 using Markdown. I doubt I'd ever bother to write that many using plain HTML.
by Semiapies on 1/14/24, 5:51 PM
On the other hand, I've written a lot of HTML since the 90s. And there's a dirty secret behind why so many static generators exist--the effort of slapping together something that builds a site how you want it is similar to learning an existing system. Often, that's a short build script rather than some expansive framework.
by CM30 on 1/14/24, 7:23 PM
Maybe I just don't like being limited by abstractions.
by hiAndrewQuinn on 1/14/24, 7:03 PM
My typical tool of choice for static sites and plain old prototyping remains Hugo, which rounds out at least half a dozen other websites I'm the sole contributor to right now, like https://hiandrewquinn.github.io/selkouutiset-archive/. Like everything you have to amortize the one time cost of learning it over the n times you use it. If you only ever make one website, raw HTML might be fine -- if you're trying to make 100, some experimentation might be worthwhile.
by yladiz on 1/15/24, 5:06 AM
by ulrischa on 1/14/24, 7:20 PM
by JonChesterfield on 1/14/24, 9:32 PM
Css on the other hand I hate more every day I look at it. Write some, see if it behaved as expected, it did not. Iterate until angry. There's something fundamentally wrong in my mental model for what the style text is likely to do to the appearance of the page.
by malkosta on 1/14/24, 8:26 PM
for file in .md; do pandoc --quiet --template template.html $file -o "${file%.}.html" done
by foul on 1/14/24, 11:49 PM
by proc0 on 1/12/24, 4:23 AM