#Development #Guides
The HTML ‘cite’ element · What belongs in a ‘cite’ element, and does it matter? https://ilo.im/163l7s
_____
#Citation #HTML #HTML4 #HTML5 #WebStandards #WebDev #Frontend

#Development #Guides
The HTML ‘cite’ element · What belongs in a ‘cite’ element, and does it matter? https://ilo.im/163l7s
_____
#Citation #HTML #HTML4 #HTML5 #WebStandards #WebDev #Frontend
Given that the biggest obstacle to the adoption of microformats is the lack of programs that actually implement them, I have been toying with the idea of writing some useful programs that work with all the information we put onto our websites.
It's frustrating that we're at a point where the bottleneck of the Semantic Web ideal is not actually a low amount of structured information, but the lack of any program to do anything interesting whatsoever with it!
Who cares if we all use the HTML5 tag on our sites, if there is no browser that actually provides a "contact webmaster" button in the sidebar?
Who cares if we all mark up our cooking recipes as perfectly detailed machine readable h-recipe entries, if there is zero cooking apps or whatever actually capable of using any of the data we provide?
Who cares if we all use h-cards and h-feeds and whatnot if there is no feed reader that can actually notify us when our friends posted a new blog entry?
Title: Phaser
️ What's: A libre Javascript framework for developing HTML5 games for PCs, mobiles & browsers
️ https://phaser.io/
️ https://github.com/photonstorm/phaser
#LinuxGameDev #Programming #Framework #HTML5
️ #Libre #SRC #Bin
Our entry: https://lebottinlinux.vps.a-lec.org/LO.html
️ Update: 4.0.0 RC 2
New features
️ Changes: https://github.com/phaserjs/phaser/releases
️ From:
️ https://github.com/photonstorm/phaser/releases.atom
️ https://www.youtube.com/embed/jHTRu4iNTcA
https://www.youtube.com/embed/0qtg-9M3peI
[fr] https://www.youtube.com/embed/sUkcd0Rrpis
️ https://www.youtube.com/embed/gnfgwkVg7vc
Build your own blog today with our amazing Ink Blog WordPress theme - Clean, modern, stylish and minimalist responsive blog template for WordPress https://visualmodo.com/theme/ink-wordpress-theme/
Build your own blog, write your legacy!
#webdesign #HTML5 #CSS3 #template #plugins #theme #wordpress #blog #magazine #responsive #news #media #marketing #SEO #post #writer #grid
Create your own website with our amazing and smart Zenith WordPress theme for every design project style https://visualmodo.com/theme/zenith-wordpress-theme/ Build your responsive site design without coding, choose a tool that works and adds power to your WordPress!
Portfolio website builder theme and templates with premium plugins for free
#WordPress #Theme #PageBuilder #WebDesign #Responsive #Retina #WebSite #plugins #template #blog #portfolio #agency #Business #Marketing #SEO #HTML5 #CSS3 #SiteBuilder
Was reminded of this historical artefact i penned/collated upon the release of #HTML5 back in 2014
Edge WordPress Theme - Build an amazing site design without coding. Use our awesome drag & drop page builder and the fastest theme on the market https://visualmodo.com/theme/edge-wordpress-theme/
Build better websites with Visualmodo and grow your business!
#webdesign #HTML5 #CSS3 #template #plugins #themes #WordPress #onepage #ecommerce #responsive #retina #marketing #SEO #website #Bootstrap #agency #siteBuilder #business
Title: Phaser
️ What's: A libre Javascript framework for developing HTML5 games for PCs, mobiles & browsers
️ https://phaser.io/
️ https://github.com/photonstorm/phaser
#LinuxGameDev #Programming #Framework #HTML5
️ #Libre #SRC #Bin
Our entry: https://lebottinlinux.vps.a-lec.org/LO.html
️ Update: 4.0.0 RC 1
Signific. vers.
️
️ Changes: https://github.com/phaserjs/phaser/releases
️ From:
️ https://github.com/photonstorm/phaser/releases.atom
️ https://www.youtube.com/embed/jHTRu4iNTcA
https://www.youtube.com/embed/0qtg-9M3peI
[fr] https://www.youtube.com/embed/sUkcd0Rrpis
️ https://www.youtube.com/embed/gnfgwkVg7vc
@ajsadauskas @JessTheUnstill @tomiahonen yes, and to add insult to injury #Mozilla didn't even wanted to sell people like @fuchsiii or me a #FirefoxOS device, with the only one being "launched" in the #EU being a #SimLock'd & #NetLock'd #prepaid phone in #Spain one could only attain in-store with all the "#KYC" nonsense they had, demanding a legal address in Spain back then.
And #nerds like myself are far from the "#consoomer #Normies" for whom stuff that isn't on shelves at Staturn/MediaMarkt, BestBuy, Walmart, ... doesn't exist. I'm used to importing #tech that I want!
An opinionated HTML Serializer for PHP 8.4
https://shkspr.mobi/blog/2025/04/an-opinionated-html-serializer-for-php-8-4/
A few days ago, I wrote a shitty pretty-printer for PHP 8.4's new Dom\HTMLDocument class.
I've since re-written it to be faster and more stylistically correct.
It turns this:
<html lang="en-GB"><head><title id="something">Test</title></head><body><h1 class="top upper">Testing</h1><main><p>Some <em>HTML</em> and an <img src="example.png" alt="Alternate Text"></p>Text not in an element<ol><li>List</li><li>Another list</li></ol></main></body></html>
Into this:
<!doctype html><html lang=en-GB> <head> <title id=something>Test</title> </head> <body> <h1 class="top upper">Testing</h1> <main> <p> Some <em>HTML</em> and an <img src=example.png alt="Alternate Text"> </p> Text not in an element <ol> <li>List</li> <li>Another list</li> </ol> </main> </body></html>
I say it is "opinionated" because it does the following:
<pre>
blocks which contain markup.It is primarily designed to make the markup easy to read. Because according to the experts:
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.
I'm fairly sure this all works properly. But feel free to argue in the comments or send me a pull request.
Here's how it works.
When is an element not an element? When it is a void!
Modern HTML has the concept of "Void Elements". Normally, something like <a>
must eventually be followed by a closing </a>
. But Void Elements don't need closing.
This keeps a list of elements which must not be explicitly closed.
$void_elements = [ "area", "base", "br", "col", "embed", "hr", "img", "input", "link", "meta", "param", "source", "track", "wbr",];
Tabs Space
Tabs, obviously. Users can set their tab width to their personal preference and it won't get confused with semantically significant whitespace.
$indent_character = "\t";
Setting up the DOM
The new HTMLDocument should be broadly familiar to anyone who has used the previous one.
$html = '<html lang="en-GB"><head><title id="something">Test</title></head><body><h1 class="top upper">Testing</h1><main><p>Some <em>HTML</em> and an <img src="example.png" alt="Alternate Text"></p>Text not in an element<ol><li>List</li><li>Another list</li></ol></main></body></html>>'$dom = Dom\HTMLDocument::createFromString( $html, LIBXML_NOERROR, "UTF-8" );
This automatically adds <head>
and <body>
elements. If you don't want that, use the LIBXML_HTML_NOIMPLIED
flag:
$dom = Dom\HTMLDocument::createFromString( $html, LIBXML_NOERROR | LIBXML_HTML_NOIMPLIED, "UTF-8" );
To Quote or Not To Quote?
Traditionally, HTML attributes needed quotes:
<img src="example.png" class="avatar no-border" id="user-123">
Modern HTML allows those attributes to be unquoted as long as they don't contain ASCII Whitespace or certain other characters
For example, the above becomes:
<img src=example.png class="avatar no-border" id=user-123>
This function looks for the presence of those characters:
function value_unquoted( $haystack ){ // Must not contain specific characters $needles = [ // https://infra.spec.whatwg.org/#ascii-whitespace "\t", "\n", "\f", "\n", " ", // https://html.spec.whatwg.org/multipage/syntax.html#unquoted "\"", "'", "=", "<", ">", "`" ]; foreach ( $needles as $needle ) { if ( str_contains( $haystack, $needle ) ) { return false; } } // Must not be null if ( $haystack == null ) { return false; } return true;}
Re-re-re-recursion
I've tried to document this as best I can.
It traverses the DOM tree, printing out correctly indented opening elements and their attributes. If there's text content, that's printed. If an element needs closing, that's printed with the appropriate indentation.
function serializeHTML( $node, $treeIndex = 0, $output = ""){ global $indent_character, $preserve_internal_whitespace, $void_elements; // Manually add the doctype to start. if ( $output == "" ) { $output .= "<!doctype html>\n"; } if( property_exists( $node, "localName" ) ) { // This is an Element. // Get all the Attributes (id, class, src, &c.). $attributes = ""; if ( property_exists($node, "attributes")) { foreach( $node->attributes as $attribute ) { $value = $attribute->nodeValue; // Only add " if the value contains specific characters. $quote = value_unquoted( $value ) ? "" : "\""; $attributes .= " {$attribute->nodeName}={$quote}{$value}{$quote}"; } } // Print the opening element and all attributes. $output .= "<{$node->localName}{$attributes}>"; } else if( property_exists( $node, "nodeName" ) && $node->nodeName == "#comment" ) { // Comment $output .= "<!-- {$node->textContent} -->"; } // Increase indent. $treeIndex++; $tabStart = "\n" . str_repeat( $indent_character, $treeIndex ); $tabEnd = "\n" . str_repeat( $indent_character, $treeIndex - 1); // Does this node have children? if( property_exists( $node, "childElementCount" ) && $node->childElementCount > 0 ) { // Loop through the children. $i=0; while( $childNode = $node->childNodes->item( $i++ ) ) { // Is this a text node? if ($childNode->nodeType == 3 ) { // Only print output if there's no HTML inside the content. // Ignore Void Elements. if ( !str_contains( $childNode->textContent, "<" ) && property_exists( $childNode, "localName" ) && !in_array( $childNode->localName, $void_elements ) ) { $output .= $tabStart . $childNode->textContent; } } else { $output .= $tabStart; } // Recursively indent all children. $output = serializeHTML( $childNode, $treeIndex, $output ); }; // Suffix with a "\n" and a suitable number of "\t"s. $output .= "{$tabEnd}"; } else if ( property_exists( $node, "childElementCount" ) && property_exists( $node, "innerHTML" ) ) { // If there are no children and the node contains content, print the contents. $output .= $node->innerHTML; } // Close the element, unless it is a void. if( property_exists( $node, "localName" ) && !in_array( $node->localName, $void_elements ) ) { $output .= "</{$node->localName}>"; } // Return a string of fully indented HTML. return $output;}
Print it out
The serialized string hardcodes the <!doctype html>
- which is probably fine. The full HTML is shown with:
echo serializeHTML( $dom->documentElement );
Next Steps
Please raise any issues on GitLab or leave a comment.
blog! “An opinionated HTML Serializer for PHP 8.4”
A few days ago, I wrote a shitty pretty-printer for PHP 8.4's new Dom\HTMLDocument class.
I've since re-written it to be faster and more stylistically correct.
It turns this:
<html lang="en-GB"><head><title id="something">Test</title></head><body><h1 class="top upper">Testing</h1><main><p>Some <em>HTML</em> and an…
Read more: https://shkspr.mobi/blog/2025/04/an-opinionated-html-serializer-for-php-8-4/
⸻
#HowTo #HTML5 #php
Build any site design without coding! You can have a fully equipped website up and running within just a few minutes. Spark WordPress theme is not just a theme, it’s a collection of amazing examples with tons of features.
https://visualmodo.com/theme/spark-wordpress-theme/
Build your own website with Visualmodo!
#webdesign #HTML5 #CSS3 #template #plugins #themes #WordPress #ecommerce #responsive #retina #marketing #SEO #website #LandingPage #SiteBuilder
On vacation, so hacking on some personal website tools. I _love_ contentEditable and am enjoying hacking together a native content editor just because. I'm just going to save some innerHTML to actual .html files and it's beautiful. #html5
Did a double take on a link provided by @sacha
Did not realize that adding the suffix `#:~:text=<starting phrase>,<ending phrase>` would scroll a modern browser to that text, and highlight it.
Title: Phaser
️ What's: A libre Javascript framework for developing HTML5 games for PCs, mobiles & browsers
️ https://phaser.io/
️ https://github.com/photonstorm/phaser
#LinuxGameDev #Programming #Framework #HTML5
️ #Libre #SRC #Bin
Our entry: https://lebottinlinux.vps.a-lec.org/LO.html
️ Update: 4.0.0 Beta 8
Code improvement
️
️ Changes: https://phaser.io/news/2025/01/phaser-v4-beta-5-released
️ From:
️ https://github.com/photonstorm/phaser/releases.atom
️ https://www.youtube.com/embed/jHTRu4iNTcA
https://www.youtube.com/embed/0qtg-9M3peI
[fr] https://www.youtube.com/embed/sUkcd0Rrpis
️ https://www.youtube.com/embed/gnfgwkVg7vc
Mettiamo alla prova Gemma 3, il nuovo modello linguistico di Google che può essere eseguito su una singola GPU. Il test riguarda il riconoscimento di immagini di videogiochi che il modello linguistico deve poi riprodurre in HTML5. Per non rendere il compito impossibile, scegliamo immagini di videogiochi classici: Pong e Asteroids. Riuscirà il nostro eroe virtuale nell'impresa? #gemma3 #intelligenzaartificiale #programmazione #html5 #javascript https://www.youtube.com/watch?v=10B7JyZjGuk
Did you know that web games are back in style again? Get in on the action and launch your next Defold game on Poki and reach 90M active players.
Bubbles, a vanilla JavaScript web game