snabelen.no is one of the many independent Mastodon servers you can use to participate in the fediverse.
Ein norsk heimstad for den desentraliserte mikroblogge-plattformen.

Administrert av:

Serverstatistikk:

447
aktive brukere

#html

47 innlegg41 deltakere6 innlegg i dag
Steve Faulkner<p>Was reminded of this historical artefact i penned/collated upon the release of <a href="https://mastodon.social/tags/HTML5" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML5</span></a> back in 2014</p><p><a href="https://mastodon.social/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://mastodon.social/tags/WebStandards" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebStandards</span></a> <span class="h-card" translate="no"><a href="https://w3c.social/@w3c" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>w3c</span></a></span> </p><p><a href="https://html5doctor.com/the-ride-to-5/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">html5doctor.com/the-ride-to-5/</span><span class="invisible"></span></a></p>
Blain Smith<p>We're weeks away from being feature complete and we're still JavaScript free in our app. Even our delete confirmations are just regular server rendered HTML and form POST actions. </p><p><a href="https://fosstodon.org/tags/SmolWeb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SmolWeb</span></a> <a href="https://fosstodon.org/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://fosstodon.org/tags/WebApp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebApp</span></a> <a href="https://fosstodon.org/tags/NoJavaScriptNeeded" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>NoJavaScriptNeeded</span></a></p>
Patrick Leavy<p>Question for you <a href="https://mastodon.social/tags/webdev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webdev</span></a> peeps:</p><p>I've made a site and it's totally in dark mode. How I like it 😊</p><p>But some people mentioned that I should offer a light mode toggle because "some people are not used to dark mode and won't like it".</p><p>Do you think that's valid? </p><p>(Someone else said that there's also potentially an accessibility issue with dark mode - is that true?)</p><p><a href="https://mastodon.social/tags/websitedesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>websitedesign</span></a> <a href="https://mastodon.social/tags/html" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>html</span></a> <a href="https://mastodon.social/tags/accessibility" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>accessibility</span></a> <a href="https://mastodon.social/tags/darkmode" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>darkmode</span></a> <a href="https://mastodon.social/tags/lightmode" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>lightmode</span></a> <a href="https://mastodon.social/tags/webdesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webdesign</span></a> <a href="https://mastodon.social/tags/mastodev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>mastodev</span></a></p>
Marei<p>[1/2] Die zweite Präsentation bleibt beim Thema Barrierefreiheit und Ulrike Fischer zeigt einige unterschiedlichen Varianten um <a href="https://chaos.social/tags/TeXLaTeX" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TeXLaTeX</span></a> nach <a href="https://chaos.social/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> zu wandeln.<br>Ein Ansatz, den ich zum Beispiel für das frühere Backend der <span class="h-card" translate="no"><a href="https://chaos.social/@datenschleuder" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>datenschleuder</span></a></span> umgesetzt hatte, um epub mitzuliefern.</p><p>Es wird <a href="https://chaos.social/tags/tex4ht" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>tex4ht</span></a>, <a href="https://chaos.social/tags/Pandoc" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Pandoc</span></a>, <a href="https://chaos.social/tags/LaTeXML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LaTeXML</span></a>, <a href="https://chaos.social/tags/lwarp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>lwarp</span></a> und auch der Weg via <a href="https://chaos.social/tags/NGPDF" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>NGPDF</span></a> (HTML aus den <a href="https://chaos.social/tags/TaggedPDF" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TaggedPDF</span></a>) gezeigt und verglichen.</p><p><a href="https://chaos.social/tags/DANTE2025" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DANTE2025</span></a> <a href="https://chaos.social/tags/TeX" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>TeX</span></a> <a href="https://chaos.social/tags/LaTeX" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>LaTeX</span></a></p>
adamghill<p>This explains an approach I’ve been dabbling with here and there for <a href="https://indieweb.social/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a>. Nice middle ground between “div soup” and the “all utility classes” approaches. <a href="https://jordanbrennan.hashnode.dev/tac-a-new-css-methodology" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">jordanbrennan.hashnode.dev/tac</span><span class="invisible">-a-new-css-methodology</span></a> <a href="https://indieweb.social/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a></p>
Reilly Spitzfaden (they/them)<p>I hadn't heard of it before, but it turns out there's a style format called XSLT that allows the browser to translate an XML file into HTML with CSS styling for display purposes. <br> <br>Since my feed is Atom rather than RSS, I had a bit of trouble, but this post was helpful:</p><p><a href="https://andrewstiefel.com/style-atom-xsl/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">andrewstiefel.com/style-atom-x</span><span class="invisible">sl/</span></a></p><p><a href="https://hachyderm.io/tags/RSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>RSS</span></a> <a href="https://hachyderm.io/tags/Atom" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Atom</span></a> <a href="https://hachyderm.io/tags/XML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XML</span></a> <a href="https://hachyderm.io/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://hachyderm.io/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a> <a href="https://hachyderm.io/tags/XSL" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XSL</span></a> <a href="https://hachyderm.io/tags/XSLT" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XSLT</span></a> <a href="https://hachyderm.io/tags/WebDev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDev</span></a> <a href="https://hachyderm.io/tags/IndieWeb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>IndieWeb</span></a> <a href="https://hachyderm.io/tags/SmallWeb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SmallWeb</span></a></p>
Reilly Spitzfaden (they/them)<p>I figured out how to get my RSS feed to be human-readable and nice-looking! </p><p>I'd been wanting to do this to give people who aren't familiar with RSS an easier on-ramp to the stuff I care about. </p><p>I figure if someone new to RSS clicks on the link and just gets raw XML, they might think something is “broken” and not stick around, but now there's something human-readable and with instructions on how to follow it in a reader.</p><p><a href="https://reillyspitzfaden.com/feed.xml" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">reillyspitzfaden.com/feed.xml</span><span class="invisible"></span></a></p><p><a href="https://hachyderm.io/tags/RSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>RSS</span></a> <a href="https://hachyderm.io/tags/Atom" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Atom</span></a> <a href="https://hachyderm.io/tags/XML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XML</span></a> <a href="https://hachyderm.io/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://hachyderm.io/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a> <a href="https://hachyderm.io/tags/XSL" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XSL</span></a> <a href="https://hachyderm.io/tags/XSLT" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>XSLT</span></a> <a href="https://hachyderm.io/tags/WebDev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDev</span></a> <a href="https://hachyderm.io/tags/IndieWeb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>IndieWeb</span></a> <a href="https://hachyderm.io/tags/SmallWeb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SmallWeb</span></a></p>
David Bisset<p>"Rewriting my site in vanilla web"</p><p><a href="https://leanrada.com/notes/vanilla-web-rewrite/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">leanrada.com/notes/vanilla-web</span><span class="invisible">-rewrite/</span></a></p><p><a href="https://phpc.social/tags/webdev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webdev</span></a> <a href="https://phpc.social/tags/JavaScript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JavaScript</span></a> <a href="https://phpc.social/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://phpc.social/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a></p>
Adrian Roselli<p>New post: “Mainlining Mains”<br><a href="https://adrianroselli.com/2025/04/mainlining-mains.html" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">adrianroselli.com/2025/04/main</span><span class="invisible">lining-mains.html</span></a></p><p><a href="https://toot.cafe/tags/accessibility" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>accessibility</span></a> <a href="https://toot.cafe/tags/a11y" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>a11y</span></a> <a href="https://toot.cafe/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://toot.cafe/tags/ARIA" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ARIA</span></a></p>
David O'Brien<p>This is a nice approach to <a href="https://mastodon.scot/tags/responsive" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>responsive</span></a> <a href="https://mastodon.scot/tags/tables" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>tables</span></a> in <a href="https://mastodon.scot/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> from the BBC</p><p><a href="https://www.bbc.co.uk/sport/football/scottish-championship/table" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="ellipsis">bbc.co.uk/sport/football/scott</span><span class="invisible">ish-championship/table</span></a></p><p>At wider screen sizes, you see the whole thing. Narrower screen sizes have a 'freeze columns' Excel-type effect.</p><p>I haven't tested it with ATs myself, I assume they have ;)</p><p><a href="https://mastodon.scot/tags/A11y" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>A11y</span></a> <a href="https://mastodon.scot/tags/Accessibility" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Accessibility</span></a></p>
Jack C.<p>Finally got the blog section of my wife's website to a point where I was comfortable putting it online. It's my first fully hand-coded HTML/CSS project and I knew I wanted it to feel fun and not look like bootstrap. I know there's plenty I could improve, but I think this is a good milestone. For instance, who knows what the preview card will look like? </p><p><a href="https://mskiersten.com/blog/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">mskiersten.com/blog/</span><span class="invisible"></span></a></p><p><a href="https://indieweb.social/tags/webdev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>webdev</span></a> <a href="https://indieweb.social/tags/wagtail" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>wagtail</span></a> <a href="https://indieweb.social/tags/django" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>django</span></a> <a href="https://indieweb.social/tags/html" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>html</span></a> <a href="https://indieweb.social/tags/css" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>css</span></a> <a href="https://indieweb.social/tags/personalsite" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>personalsite</span></a> <a href="https://indieweb.social/tags/blog" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>blog</span></a></p>
LtningTrying to optimise <a href="http://floppy.museum" rel="nofollow noopener noreferrer" target="_blank">http://floppy.museum</a> for (even) older browsers. Some of the issues I'm trying to solve include utf8-to-latin1 translation (the original HTML has some silly double- and triple-byte characters), and variations of JPEG that simply aren't understood.<br><br>Turns out Netscape 2.02 is too easy, so in this picture is IBM WebExplorer v1.1h running on OS/2 Warp Connect. Using the magic "work area" feature of folders (mark a folder as a work area to have the OS manage objects within it as a kind of unit), I can open several windows at once. True multi-process browsing 😉<br><br><a href="https://weirdr.net/snac?t=retrocomputing" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#retrocomputing</a> <a href="https://weirdr.net/snac?t=browsers" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#browsers</a> <a href="https://weirdr.net/snac?t=floppy" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#floppy</a> <a href="https://weirdr.net/snac?t=museum" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#museum</a> <a href="https://weirdr.net/snac?t=html" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#html</a> <a href="https://weirdr.net/snac?t=browserwars" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#BrowserWars</a><br>
jfmblinux :jeditux:<p>SVG and PNG tech icons</p><p>Download, copy and paste tech icons in SVG and PNG format for your projects. </p><p><a href="https://mastodon.jfmblinux.fr/tags/Html" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Html</span></a> <a href="https://mastodon.jfmblinux.fr/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a> <a href="https://mastodon.jfmblinux.fr/tags/SVG" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SVG</span></a> <a href="https://mastodon.jfmblinux.fr/tags/PNG" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>PNG</span></a> <br><a href="https://mastodon.jfmblinux.fr/tags/Mastodon" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Mastodon</span></a> <a href="https://mastodon.jfmblinux.fr/tags/Fediverse" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Fediverse</span></a> <a href="https://mastodon.jfmblinux.fr/tags/Pixelfed" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Pixelfed</span></a> <a href="https://mastodon.jfmblinux.fr/tags/Nextcloud" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Nextcloud</span></a> </p><p><a href="https://techicons.dev/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">techicons.dev/</span><span class="invisible"></span></a></p>
James Scholes<p>Recent datepicker experience:<br>1. Control is presented as three separate spin controls, supporting the Up/Down Arrow keys to increment and decrement the value as well as manual typing. But because they're not text inputs, I can't use the Left/Right Arrow keys to review what each separate one contains, only to move between day, month, and year.<br>2. I tab to year.<br>3. I press Down Arrow, and the value is set to 2075. I'm unclear how many use cases require the year to be frequently set to 2075, but I can't imagine it's many so this seems like a fairly ridiculous starting point.<br>4. I press Up Arrow, and the value gets set to 0001. The number of applications for which 0001 is a valid year is likewise vanishingly small.<br>5. I delete the 0001, at which point my <a href="https://dragonscave.space/tags/screenReader" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>screenReader</span></a> reports that the current value is "0". Also not a valid year.<br>6. Out of curiosity, I inspect the element to see which third-party component is being used to create this mess... only to find that it's a native `&lt;input&gt;` with `type="date"` and this is just how Google Chrome presents it.</p><p>A good reminder that <a href="https://dragonscave.space/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> is not always the most <a href="https://dragonscave.space/tags/accessible" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>accessible</span></a> or user-friendly.</p><p><a href="https://dragonscave.space/tags/accessibility" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>accessibility</span></a> <a href="https://dragonscave.space/tags/usability" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>usability</span></a></p>
Aral Balkan<p>New Kitten update</p><p>• 🥳 Kitten HTML templates and kitten.Component render functions can now be async.</p><p><a href="https://kitten.small-web.org" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="">kitten.small-web.org</span><span class="invisible"></span></a></p><p>This is quite a big one and it took me finally biting the bullet and getting my head around generators in JavaScript to implement properly.</p><p>So now you can mix synchronous and asynchronous components as you like and if there are any asynchronous components in your templates they will automatically be awaited (even if you forget to use await) ;)</p><p>I’ll write a proper post/tutorial/documentation for it soon but for the time being enjoy the screenshots where a layout template gets the latest three posts from my mock fediverse public timeline service and displays them on the page.</p><p>The kitten.Component version also has a refresh button that streams a different three to the page.</p><p>For those of you unfamiliar with Kitten, this is all the code in either example. No scaffolding, nothing. Pop either into a file called index.page.js and run kitten in that folder and visit https://localhost to see the example run.</p><p>Enjoy!</p><p>:kitten:💕</p><p><a href="https://mastodon.ar.al/tags/Kitten" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Kitten</span></a> <a href="https://mastodon.ar.al/tags/SmallWeb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SmallWeb</span></a> <a href="https://mastodon.ar.al/tags/async" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>async</span></a> <a href="https://mastodon.ar.al/tags/components" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>components</span></a> <a href="https://mastodon.ar.al/tags/templates" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>templates</span></a> <a href="https://mastodon.ar.al/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://mastodon.ar.al/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a> <a href="https://mastodon.ar.al/tags/JavaScript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JavaScript</span></a> <a href="https://mastodon.ar.al/tags/NodeJS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>NodeJS</span></a> <a href="https://mastodon.ar.al/tags/generators" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>generators</span></a> <a href="https://mastodon.ar.al/tags/web" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>web</span></a> <a href="https://mastodon.ar.al/tags/dev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>dev</span></a></p>
Terence Eden’s Blog<p><strong>Pretty Print HTML using PHP 8.4's new HTML DOM</strong></p><p><a href="https://shkspr.mobi/blog/2025/03/pretty-print-html-using-php-8-4s-new-html-dom/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2025/03/prett</span><span class="invisible">y-print-html-using-php-8-4s-new-html-dom/</span></a></p><p>Those whom the gods would send mad, they first teach recursion.</p><p>PHP 8.4 introduces a new <a href="https://www.php.net/manual/en/class.dom-htmldocument.php" rel="nofollow noopener noreferrer" target="_blank">Dom\HTMLDocument class</a> it is a modern HTML5 replacement for the ageing XHTML based DOMDocument. You can <a href="https://wiki.php.net/rfc/domdocument_html5_parser" rel="nofollow noopener noreferrer" target="_blank">read more about how it works</a> - the short version is that it reads and correctly sanitises HTML and turns it into a nested object. Hurrah!</p><p>The one thing it <em>doesn't</em> do is pretty-printing. When you call <code>$dom-&gt;saveHTML()</code> it will output something like:</p><pre><code>&lt;html lang="en-GB"&gt;&lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Testing&lt;/h1&gt;&lt;main&gt;&lt;p&gt;Some &lt;em&gt;HTML&lt;/em&gt; and an &lt;img src="example.png"&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;List&lt;/li&gt;&lt;li&gt;Another list&lt;/li&gt;&lt;/ol&gt;&lt;/main&gt;&lt;/body&gt;&lt;/html&gt;</code></pre><p>Perfect for a computer to read, but slightly tricky for humans.</p><p>As was <a href="https://libraries.mit.edu/150books/2011/05/11/1985/" rel="nofollow noopener noreferrer" target="_blank">written by the sages</a>:</p><blockquote><p>A computer language is not just a way of getting a computer to perform operations but rather … it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute.</p></blockquote><p>HTML <em>is</em> a programming language. Making markup easy to read for humans is a fine and noble goal. The aim is to turn the single line above into something like:</p><pre><code>&lt;html lang="en-GB"&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Testing&lt;/h1&gt; &lt;main&gt; &lt;p&gt;Some &lt;em&gt;HTML&lt;/em&gt; and an &lt;img src="example.png"&gt;&lt;/p&gt; &lt;ol&gt; &lt;li&gt;List&lt;/li&gt; &lt;li&gt;Another list&lt;/li&gt; &lt;/ol&gt; &lt;/main&gt; &lt;/body&gt;&lt;/html&gt;</code></pre><p>Cor! That's much better!</p><p>I've cobbled together a script which is <em>broadly</em> accurate. There are a million-and-one edge cases and about twice as many personal preferences. This aims to be quick, simple, and basically fine. I am indebted to <a href="https://topic.alibabacloud.com/a/php-domdocument-recursive-formatting-of-indented-html-documents_4_86_30953142.html" rel="nofollow noopener noreferrer" target="_blank">this random Chinese script</a> and to <a href="https://github.com/wasinger/html-pretty-min" rel="nofollow noopener noreferrer" target="_blank">html-pretty-min</a>.</p><p><strong>Step By Step</strong></p><p>I'm going to walk through how everything works. This is as much for my benefit as for yours! This is beta code. It sorta-kinda-works for me. Think of it as a first pass at an attempt to prove that something can be done. Please don't use it in production!</p><p><strong>Setting up the DOM</strong></p><p>The new HTMLDocument should be broadly familiar to anyone who has used the previous one.</p><pre><code>$html = '&lt;html lang="en-GB"&gt;&lt;head&gt;&lt;title&gt;Test&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;h1&gt;Testing&lt;/h1&gt;&lt;main&gt;&lt;p&gt;Some &lt;em&gt;HTML&lt;/em&gt; and an &lt;img src="example.png"&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;List&lt;li&gt;Another list&lt;/body&gt;&lt;/html&gt;'$dom = Dom\HTMLDocument::createFromString( $html, LIBXML_NOERROR, "UTF-8" );</code></pre><p>This automatically adds <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code> elements. If you don't want that, use the <a href="https://www.php.net/manual/en/libxml.constants.php#constant.libxml-html-noimplied" rel="nofollow noopener noreferrer" target="_blank"><code>LIBXML_HTML_NOIMPLIED</code> flag</a>:</p><pre><code>$dom = Dom\HTMLDocument::createFromString( $html, LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED, "UTF-8" );</code></pre><p><strong>Where not to indent</strong></p><p>There are certain elements whose contents shouldn't be pretty-printed because it might change the meaning or layout of the text. For example, in a paragraph:</p><pre><code>&lt;p&gt; Some &lt;em&gt; HT &lt;strong&gt;M&lt;/strong&gt; L &lt;/em&gt;&lt;/p&gt;</code></pre><p>I've picked these elements from <a href="https://html.spec.whatwg.org/multipage/text-level-semantics.html#text-level-semantics" rel="nofollow noopener noreferrer" target="_blank">text-level semantics</a> and a few others which I consider sensible. Feel free to edit this list if you want.</p><pre><code>$preserve_internal_whitespace = [ "a", "em", "strong", "small", "s", "cite", "q", "dfn", "abbr", "ruby", "rt", "rp", "data", "time", "pre", "code", "var", "samp", "kbd", "sub", "sup", "b", "i", "mark", "u", "bdi", "bdo", "span", "h1", "h2", "h3", "h4", "h5", "h6", "p", "li", "button", "form", "input", "label", "select", "textarea",];</code></pre><p>The function has an option to <em>force</em> indenting every time it encounters an element.</p><p><strong>Tabs 🆚 Space</strong></p><p>Tabs, obviously. Users can set their tab width to their personal preference and it won't get confused with semantically significant whitespace.</p><pre><code>$indent_character = "\t";</code></pre><p><strong>Recursive Function</strong></p><p>This function reads through each node in the HTML tree. If the node should be indented, the function inserts a new node with the requisite number of tabs before the existing node. It also adds a suffix node to indent the next line appropriately. It then goes through the node's children and recursively repeats the process.</p><p><strong>This modifies the existing Document</strong>.</p><pre><code>function prettyPrintHTML( $node, $treeIndex = 0, $forceWhitespace = false ){ global $indent_character, $preserve_internal_whitespace; // If this node contains content which shouldn't be separately indented // And if whitespace is not forced if ( property_exists( $node, "localName" ) &amp;&amp; in_array( $node-&gt;localName, $preserve_internal_whitespace ) &amp;&amp; !$forceWhitespace ) { return; } // Does this node have children? if( property_exists( $node, "childElementCount" ) &amp;&amp; $node-&gt;childElementCount &gt; 0 ) { // Move in a step $treeIndex++; $tabStart = "\n" . str_repeat( $indent_character, $treeIndex ); $tabEnd = "\n" . str_repeat( $indent_character, $treeIndex - 1); // Remove any existing indenting at the start of the line $node-&gt;innerHTML = trim($node-&gt;innerHTML); // Loop through the children $i=0; while( $childNode = $node-&gt;childNodes-&gt;item( $i++ ) ) { // Was the *previous* sibling a text-only node? // If so, don't add a previous newline if ( $i &gt; 0 ) { $olderSibling = $node-&gt;childNodes-&gt;item( $i-1 ); if ( $olderSibling-&gt;nodeType == XML_TEXT_NODE &amp;&amp; !$forceWhitespace ) { $i++; continue; } $node-&gt;insertBefore( $node-&gt;ownerDocument-&gt;createTextNode( $tabStart ), $childNode ); } $i++; // Recursively indent all children prettyPrintHTML( $childNode, $treeIndex, $forceWhitespace ); }; // Suffix with a node which has "\n" and a suitable number of "\t" $node-&gt;appendChild( $node-&gt;ownerDocument-&gt;createTextNode( $tabEnd ) ); }}</code></pre><p><strong>Printing it out</strong></p><p>First, call the function. <strong>This modifies the existing Document</strong>.</p><pre><code>prettyPrintHTML( $dom-&gt;documentElement );</code></pre><p>Then call <a href="https://www.php.net/manual/en/dom-htmldocument.savehtml.php" rel="nofollow noopener noreferrer" target="_blank">the normal <code>saveHtml()</code> serialiser</a>:</p><pre><code>echo $dom-&gt;saveHTML();</code></pre><p>Note - this does not print a <code>&lt;!doctype html&gt;</code> - you'll need to include that manually if you're intending to use the entire document.</p><p><strong>Licence</strong></p><p>I consider the above too trivial to licence - but you may treat it as MIT if that makes you happy.</p><p><strong>Thoughts? Comments? Next steps?</strong></p><p>I've not written any formal tests, nor have I measured its speed, there may be subtle-bugs, and catastrophic errors. I know it doesn't work well if the HTML is already indented. It mysteriously prints double newlines for some unfathomable reason.</p><p>I'd love to know if you find this useful. Please <a href="https://gitlab.com/edent/pretty-print-html-using-php/" rel="nofollow noopener noreferrer" target="_blank">get involved on GitLab</a> or drop a comment here.</p><p><a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/howto/" target="_blank">#HowTo</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/html/" target="_blank">#HTML</a> <a rel="nofollow noopener noreferrer" class="hashtag u-tag u-category" href="https://shkspr.mobi/blog/tag/php/" target="_blank">#php</a></p>
Terence Eden<p>🆕 blog! “Pretty Print HTML using PHP 8.4's new HTML DOM”</p><p>Those whom the gods would send mad, they first teach recursion.</p><p>PHP 8.4 introduces a new Dom\HTMLDocument class it is a modern HTML5 replacement for the ageing XHTML based DOMDocument. You can read more about how it works - the short version is that it reads and correctly sanitises HTML and turns it into a…</p><p>👀 Read more: <a href="https://shkspr.mobi/blog/2025/03/pretty-print-html-using-php-8-4s-new-html-dom/" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2025/03/prett</span><span class="invisible">y-print-html-using-php-8-4s-new-html-dom/</span></a><br>⸻<br><a href="https://mastodon.social/tags/HowTo" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HowTo</span></a> <a href="https://mastodon.social/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://mastodon.social/tags/php" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>php</span></a></p>
Mia Holte<p>Vi er i 2025, og det finnes fortsatt ikke en html tag for ingress. Feks &lt;preamble&gt;. Noen som vet om det er i horisonten? <a href="https://snabelen.no/tags/html" class="mention hashtag" rel="tag">#<span>html</span></a> <a href="https://snabelen.no/tags/norsktut" class="mention hashtag" rel="tag">#<span>norsktut</span></a> <a href="https://snabelen.no/tags/uu" class="mention hashtag" rel="tag">#<span>uu</span></a></p>
Tommi 🤯<p><strong>Looking for CMS advice</strong></p><p>Hey Web devs!</p><p>Do you have any suggestions, tips, opinions, dos, don’ts about <strong>headless CMS</strong>es?</p><p>I have a growing list of small/mid non-profits and collectives asking for my help to (re)make their website. I totally want to help, but I don’t have much time, especially considering that they generally have little or no funding—I would most definitely point them to <span class="h-card" translate="no"><a href="https://toot.village.one/@VillageOneCoop" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>VillageOneCoop</span></a></span>, otherwise.</p><p>Therefore, I want a super simple and replicable solution where I can copy-paste most of the code, while providing them with a stable, fast, and modern solution. I had a look at the <a href="https://jamstack.org/headless-cms/" rel="nofollow noopener noreferrer" target="_blank">Headless CMS section in the Jamstack website</a>, but I need opinions from people who actually used some of that software already.</p><p><strong>Needs</strong></p><ul><li>I want to code and configure everything using <span class="h-card" translate="no"><a href="https://fosstodon.org/@eleventy" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>eleventy</span></a></span></li><li>Admin interface (<a href="https://pan.rent/tags/WebApp" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebApp</span></a>) for the client to add pages and write posts</li><li>Static website in the front-end</li><li>Simple and reliable CI/CD</li><li>No/minimal maintenance after the first setup</li><li>Self-hostable (I was taking this for granted so much that I forgot to write it)</li><li>If it requires forge integration, it should support <a href="https://pan.rent/tags/ForgeJo" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ForgeJo</span></a></li><li><a href="https://pan.rent/tags/OpenSource" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>OpenSource</span></a></li></ul><p><strong>Nice to have</strong></p><ul><li>Possibly using <a href="https://pan.rent/tags/Deno" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Deno</span></a>, not <a href="https://pan.rent/tags/NodeJS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>NodeJS</span></a></li><li>Allowing the client to customize a bit their website through the admin interface, with a GUI</li><li>CMS app packaged on <span class="h-card" translate="no"><a href="https://toot.aquilenet.fr/@yunohost" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>yunohost</span></a></span></li><li>No CMS vendor lock-in</li><li>I’d love to write as little JavaScript as possible</li><li><a href="https://pan.rent/tags/FreeSoftware" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>FreeSoftware</span></a></li></ul><p><strong>Absolutely not</strong></p><ul><li>Front-end <a href="https://pan.rent/tags/JavaScript" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>JavaScript</span></a> frameworks</li></ul><p>Please, boost this and ask around! Links to videos, tutorials, and resources are welcome.</p><p>People whose perspective I would really value: <span class="h-card" translate="no"><a href="https://fediverse.zachleat.com/@zachleat" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>zachleat</span></a></span> <span class="h-card" translate="no"><a href="https://mastodon.social/@harryfk" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>harryfk</span></a></span> <span class="h-card" translate="no"><a href="https://fosstodon.org/@deno_land" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>deno_land</span></a></span> <span class="h-card" translate="no"><a href="https://indieweb.social/@jaredwhite" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>jaredwhite</span></a></span> <span class="h-card" translate="no"><a href="https://intuitivefuture.com/@vanillaweb" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>vanillaweb</span></a></span> <span class="h-card" translate="no"><a href="https://stefanbohacek.online/@stefan" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>stefan</span></a></span> <span class="h-card" translate="no"><a href="https://front-end.social/@mxbck" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>mxbck</span></a></span> <span class="h-card" translate="no"><a href="https://caneandable.social/@WeirdWriter" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>WeirdWriter</span></a></span> <span class="h-card" translate="no"><a href="https://social.wedistribute.org/users/deadsuperhero" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>deadsuperhero</span></a></span> (Sorry if I am spamming you!)</p><p><a href="https://pan.rent/tags/Eleventy" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Eleventy</span></a> <a href="https://pan.rent/tags/11ty" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>11ty</span></a> <a href="https://pan.rent/tags/CMS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CMS</span></a> <a href="https://pan.rent/tags/HeadlessCMS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HeadlessCMS</span></a> <a href="https://pan.rent/tags/Ghost" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Ghost</span></a> <a href="https://pan.rent/tags/DecapCMS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>DecapCMS</span></a> <a href="https://pan.rent/tags/CraftCMS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CraftCMS</span></a> <a href="https://pan.rent/tags/Strapi" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Strapi</span></a> <a href="https://pan.rent/tags/Web" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Web</span></a> <a href="https://pan.rent/tags/WebDev" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDev</span></a> <a href="https://pan.rent/tags/WebDesign" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>WebDesign</span></a> <a href="https://pan.rent/tags/StaticGen" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>StaticGen</span></a> <a href="https://pan.rent/tags/StaticWebsite" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>StaticWebsite</span></a> <a href="https://pan.rent/tags/Website" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Website</span></a> <a href="https://pan.rent/tags/HTML" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a> <a href="https://pan.rent/tags/CSS" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>CSS</span></a> <a href="https://pan.rent/tags/YunoHost" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>YunoHost</span></a> <a href="https://pan.rent/tags/SelfHosting" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>SelfHosting</span></a> <a href="https://pan.rent/tags/Wordpress" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>Wordpress</span></a></p>
James :ruby:<p>&gt; Configuring Zed editor to use HTML Beautifier as a formatter in ERB templates</p><p><a href="https://jamesmead.org/blog/2025-03-30-configuring-zed-editor-to-use-htmlbeautifier-as-formatter-in-erb-template" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">jamesmead.org/blog/2025-03-30-</span><span class="invisible">configuring-zed-editor-to-use-htmlbeautifier-as-formatter-in-erb-template</span></a></p><p><a href="https://ruby.social/tags/zed" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>zed</span></a> <a href="https://ruby.social/tags/html" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>html</span></a> <a href="https://ruby.social/tags/erb" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>erb</span></a> <a href="https://ruby.social/tags/ruby" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>ruby</span></a></p>