While an HTML style element for inline CSS needs nothing but simple start and end tags (as of HTML5 and later)

<style>
p { color: red }
</style>

a more robust style element requires a precise series of overlapping code comments.

Here is the answer if you want a code snippet to copy & paste

<style><!--/*--><![CDATA[*/
p { color: red } /* you may delete this sample style rule */
/*]]><!--*/--></style>


Here is why:

1. Not all HTML processors are CSS processors. While all modern browsers know how to parse CSS in style elements inside HTML, it is still quite reasonable for people to build HTML processors that do not, and many exist. There are plenty of ways to errantly or deliberately misplace markup inside a style element, like in a CSS comment, that such processors will not see, that can break them and cause unexpected and different results in different processors. Strictly speaking any use of > child combinator selector syntax should also be HTML escaped (as &gt;) inside a style elment.

Thus it makes your HTML more parseable, by more processors, if you can hide the entirety of the style sheet inside the style element from such processing, including any child combinators. A CDATA section does exactly that:

<style><![CDATA[
p { color: orange } /* CDATA allows a </style> here to not close the element */
body > p { margin: 1em } /* CDATA also allows an unescaped > child combinator */
]]></style>


2. However CSS syntax does not recognize a CDATA directive (even as of the latest published CSS Syntax Module Level 3¹ or editor's draft² as of this writing). CSS parsers may very well treat a CDATA directive as a syntax error that invalidates the subsequent style rule.

Thus we must hide the CDATA directive, its opening and closing markup, from CSS parsers.  CSS code comments /* ... */ can do exactly that:

<style>/*<![CDATA[*/
p { color: orange } /* CDATA allows a </style> here to not close the element */
body > p { margin: 1em } /* CDATA also allows an unescaped > child combinator */
/*]]>*/</style>


3. This is close but still exposes HTML processors that do not process CSS to a minimal bit of content, the CSS comment opener and closer that are outside the CDATA section:

/* */

This recently showed up in a draft of the This Week in The #IndieWeb newsletter³, because portions of it are automatically constructed by parsing the HTML of MediaWiki pages for content, and one of those used a MediaWiki template that included a minimal style element to style the marked up content inserted by the template. A draft of the newsletter was showing raw CSS, extracted as text from the style element by the CSS-unaware parser extracting content. I was able to hide nearly all of it using CSS comments around the CDATA section opener and closer. Except for that little bit of CSS comment noise outside the CDATA section: /* */

Fortunately there is one more tool in our toolbox that we can use. Simple HTML/SGML comments <!-- --> are ignored at the start and end of style sheets (noted there as CDO-token and CDC-token), and thus we can use those to hide the last two remaining CSS comment pieces that were leaking out, like this: <!-- /* --> and <!-- */ -->. Note that the portion of the HTML comment directives that are inside CSS comments are ignored by CSS processors, which is why this works for both processors that parse CSS and those that do not.

This last addition produces our answer, with no fewer than three different comment mechanisms (CDATA, CSS, HTML/SGML), overlapping to hide each other from different processors:

<style><!--/*--><![CDATA[*/
p { color: orange } /* CDATA allows a </style> here to not close the element */
body > p { margin: 1em } /* CDATA also allows an unescaped > child combinator */
/*]]><!--*/--></style>

By replacing those informative style rules with a style rule to be deleted, we have recreated the code snippet to copy & paste from the top of the post:

<style><!--/*--><![CDATA[*/
p { color: red } /* you may delete this sample style rule */
/*]]><!--*/--></style>

Q.E.D.


Afterword:

If you’re reading this in a traditional feed reader and see any red or orange text, then your feed reader has a bug (or a few) in its HTML parsing code.

If you View Source on this post’s original permalink or my home page you can see the more robust style element in a real world example, following the IndieWeb Use What You Make principle.

#CSS #style #styleElement #styleSheet #HTML #HTML5 #CSSsyntax #codeComments #CDATA #SGML #CSScomment #HTMLcomment #SGMLcomment


Glossary:

CDATA
  https://en.wikipedia.org/wiki/CDATA
CSS — Cascading Style Sheets
  https://en.wikipedia.org/wiki/CSS
HTML — HyperText Markup Language
  https://en.wikipedia.org/wiki/HTML
HTML5
  https://en.wikipedia.org/wiki/HTML5
IndieWeb Principles
  https://indieweb.org/principles
MediaWiki
  https://en.wikipedia.org/wiki/MediaWiki
original permalink
  https://indieweb.org/original_permalink
Q.E.D.
  https://en.wikipedia.org/wiki/Q.E.D.

References:

¹ https://www.w3.org/TR/css-syntax-3/
² https://drafts.csswg.org/css-syntax/
³ https://indieweb.org/this-week-in-the-indieweb
https://www.w3.org/TR/css-syntax-3/#stylesheet-diagram
https://www.w3.org/TR/css-syntax-3/#CDO-token-diagram
https://www.w3.org/TR/css-syntax-3/#CDC-token-diagram
https://indieweb.org/use_what_you_make
#IndieWeb #CSS #style #styleElement #styleSheet #HTML #HTML5 #CSSsyntax #codeComments #CDATA #SGML #CSScomment #HTMLcomment #SGMLcomment

It’s Long COVID Awareness Day. An estimated 65 million people suffer from it globally. Remember that the risk of long-term health issues in multiple organs increases after each infection, even if your symptoms were mild.

Every COVID Infection Increases Your Risk of Long COVID, Study Warns

Long COVID: major findings, mechanisms and recommendations

#LongCovid #LongCovidAwareness
The 3D X-Ray machine they have at the endodontist is really cool! You can look at an X-Ray of any slice of the tooth!
#teeth #dentist #rootcanal
Well this is a new one, my lip itches but it's still numb so I can't scratch it! I keep trying to scratch it but it feels like the itch is inside it somehow 😬
Downtown Endodontic Group

Various updates

Watched Clara (2018) and enjoyed it overall. It’s a slow build but pretty good science fiction, especially for a first-time writer/director.

What I created while remotely participating at #IndieWebCamp Brighton 2024: wiki-gardened day 1’s BarCamp sessions notes pages, and documented my @-mention @-@-mention autolinking coding improvements I built the Sunday before.

Day 2 of IndieWebCamps is Create Day, where everyone is encouraged to create, make, or build something for their personal website, or the IndieWeb community, or both.

At the start of day 2, everyone is encourage to pick things to make¹. What to make at an IndieWebCamp² can be anything from setting up your personal website, to writing a blog post, redesigning your styling, building new features, helping other participants, or contributing to shared IndieWeb community resources, whether code or content.

Everyone is encouraged to at least pick something they consider easy, that they can do in less than an hour, then a more bold goal, and then perhaps a stretch goal, something challenging that may require collaboration, asking for help, or breaking into smaller steps.

For my "easy" task, I built on what another remote participant, @gregorlove.com completed the night before. gRegor had archived all the IndieWebCamp Brighton Sessions Etherpads onto the wiki, linked from the Schedule page³. gRegor had noted that he didn’t have time to clean-up the pages, e.g. convert and fix Markdown links.

I went through the 13 Session Notes archives and did the following:
* converted Markdown links to MediaWiki links
* converted indieweb.org (and some services) links to local wiki page links
* fixed (some) typos

With some help from @alexsirac.com (@alexture@todo.eu), I figured out how to create a MediaWiki Contributions summary link of my edits:
* https://indieweb.org/wiki/index.php?title=Special:Contributions&target=Tantek.com&namespace=all&start=2024-03-10&end=2024-03-10&offset=20240310143900&limit=25

I point this out to provide an example of an IndieWeb Create Day project that is:
* incremental on top of someone else’s work
* community contribution rather a personal-focused project
* editing and wiki-gardening as valid contributions, not just creating new content

I point this out to illustrate some of the IndieWeb community's recognitions & values in contrast to typical corporate cultures and incentive systems which often only reward:
* new innovations (not incremental improvements)
* solo (or maybe jointly in a small team) inventions, designs, specs, or implementations
* something large, a new service or a big feature, not numerous small edits & fixes

In this regard, the IndieWeb community shares more in common with Wikipedia and similar collaborative communities (despite the #Indie in #IndieWeb), than any corporation.


For my "more bold" goal, I wrote a medium-sized post about the auto-linking improvements I made the Sunday before the IndieWebCamp to my personal website with examples and brief descriptions of the coding changes & improvements.
* https://tantek.com/2024/070/t1/updated-auto-linking-mention-use-cases


My stretch goal was to write up a more complete auto-linking specification, based on the research I have done into @-mention @-@-mention user practices (on #Mastodon, other #ActivityPub or #fediverse implementations, and even across #socialMedia silos), as well as how implementations link URLs, domains, and paths.

That stretch goal remains a goal, however I did collect a handful of prior posts on @-mentions which I plan to source for specifying auto-linking and @-mentioning:
* https://tantek.com/2023/011/t1/indieweb-evolving-at-mention
* https://tantek.com/2023/014/t4/domain-first-federated-atmention
* https://tantek.com/2023/018/t1/elevate-indieweb-above-silo
* https://tantek.com/2023/019/t5/reply-domain-above-address-and-silo
* https://tantek.com/2023/109/t2/years-ago-first-federated-indieweb-thread
#autoLink #atDomain #atPath #atMention #atMentions #atat #atAtMention


I was one of a few remote participants in addition to ~18 in-person participants, the overwhelming majority of overall attendees, who demonstrated something at the end of IndieWebCamp Brighton 2024 day 2. See what everyone else made & demonstrated on Create Day:
* https://indieweb.org/2024/Brighton/Demos


This is post 13 of #100PostsOfIndieWeb. #100Posts

https://tantek.com/2024/070/t1/updated-auto-linking-mention-use-cases
→ 🔮


Glossary:

Create Day
  https://indieweb.org/Create_Day
IndieWebCamp Brighton 2024
  https://indieweb.org/2024/Brighton

References:

¹ https://indieweb.org/IndieWebCamps/Attending#Day_Two
² https://indieweb.org/what_to_make_at_IndieWebCamp
³ https://indieweb.org/2024/Brighton/Schedule#Saturday
#IndieWebCamp #Indie #IndieWeb #Mastodon #ActivityPub #fediverse #socialMedia #autoLink #atDomain #atPath #atMention #atMentions #atat #atAtMention #100PostsOfIndieWeb #100Posts

🗓️ The Level Up with XP

ah yes, an open letter about the web's 35th birthday, published on Medium, the notoriously open web platform... 🤦‍♂️

Current medical status

A good intro video about mutual aid: youtube.com/watch?v=rYPgTZeF5Z0

Charity affirms the existing distribution of wealth and life chances. Mutual aid challenges it. Charity is top-down. Mutual aid is horizontal. Charity is about control, hierarchy, and isolation. Mutual aid is about solidarity, liberation, and participation.

Updated the auto-linking code¹ on my website last Sunday to handle a few more @-mention use-cases.

In particular:
* @-domains with dashes/hyphens like @sonja-weckenmann.de
* @-@ with (some) Unicode alphabetic characters like @briansuda@loðfíll.is
* @-domain-and-path for indicating @-mentions of silo profiles that don’t support @-@ syntax, like @flickr.com/people/tantek or @instagram.com/tantek

I also dropped auto-linking of URLs with user:password "userinfo", since they’ve been long abandoned and effectively deprecated because there’s fairly wide agreement that such basic HTTP authentication² was poorly designed and should not be used (and thus should not be linked).

If you’re curious you can take a look at https://tantek.com/cassis.js, which has updated functions:
* auto_link_re() — regular expression to recognize URLs, @-mentions, @-@, and footnotes to link
* auto_link() — specifically the code to recognize different kinds of @-@ and @-mentions and link them properly to profiles, domains, and paths.

This code is only live on my website (testing in production³ as it were) for now, and you’re welcome to copy/paste to experiment with it. I plan to test it more over the coming weeks (or so) and when I feel it is sufficiently well tested, will update it on GitHub as well.

With this additional auto-linking functionality, I feel I have a fairly complete implementation of how to auto-link various URLs and @-mentions, and plan to write that up at least as a minimal “list of use-cases and how they should work” auto-linking specification.

This (blog post) is my contribution to today’s #IndieWebCamp Brighton #hackday!

This was originally a project I wanted to complete during IndieWebCamp Nuremberg last October, however I was pre-occupied at the time with fixing other things.

#autolink #atmention #atmentions #atat #atatmention

This is post 12 of #100PostsOfIndieWeb. #100Posts

https://tantek.com/2024/047/t1/indieweb-major-update-design
→ 🔮


¹ https://tantek.com/cassis.js
² https://en.wikipedia.org/wiki/Basic_access_authentication
³ https://indieweb.org/test_in_production
https://tantek.com/github/cassis
https://indieweb.org/2024/Brighton
https://tantek.com/2023/302/t1/indiewebcamp-completed-projects
#IndieWebCamp #hackday #autolink #atmention #atmentions #atat #atatmention #100PostsOfIndieWeb #100Posts

Acoustic panels

Today’s accomplishments

NYTimes trying to prove that we cannot have nice things on the open web. 🤬

https://www.404media.co/nytimes-files-copyright-takedowns-against-hundreds-of-wordle-clones/

Per the Times’ complaint:

The Times’s Wordle copyright includes the unique elements of its immensely popular game, such as the 5x6 grid, green tiles to indicate correct guesses, yellow tiles to indicate the correct letter but the wrong place within the word, and the keyboard directly beneath the grid. Times’s Wordle copyright includes the unique elements of its immensely popular game, such as the 5x6 grid, green tiles to indicate correct guesses, yellow tiles to indicate the correct letter but the wrong place within the word, and the keyboard directly beneath the grid.

Wow, folks. Careful about how you place keyboards relative to grids.

#copyright #bullshit #nytimes
📕 Finished reading There Is No Antimemetics Division by qntm ISBN: 9798721503788

Album almost done — test listeners needed!

Initial slipcast success!