In short this change adds support to code blocks expressed as "GFM". Example:
(three backticks)php
$asd = 1;
(three backticks)
Note that, before this change, this was the supposed syntax:
(three backticks)lang=php
$asd = 1;
(three backticks)
The logic of this implementation is:
- quickly capture whatever alien thing was expressed just after the first backticks
- if the language was not declared, check that capture with a stricter regex
- eventually use that, removing that line from the content (since it would be otherwise displayed)
This should improve performance when rendering README files from GitHub, since at the moment
the language was currently being guessed using deep dark magic.
Note that this is done before re-indenting the code, so we avoid re-indenting that parameter wasting CPU.
== What is "GitHub Flavored Markdown"? uh? ==
Premising that - as you already know - Phorge is your lovely Free
software suite that loves you, loves your software, loves to protect
your data, etc. and who in return only asks you to take your vitamins.
It comes with Remarkup that it's our lovely way to handle Markdown.
Instead, you may want to know that "GitHub" is a proprietary service,
and the only thing it wants is for you to stop using git, and use its
proprietary client instead. GitHub is so proprietary that was acquired
by a corporation called "Microsoft" that is very good in producing or
acquiring proprietary software. If this name is new to you, read these:
https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish
https://en.wikipedia.org/wiki/Halloween_documents
With these premises, and remembering "GitHub" is "ALL RIGHTS RESERVED"
all over the places, the biggest risk of this change is that Microsoft
will sue my family and my soul, for implementing similar features,
saying something like:
"HEY - BOZ - WHAT ARE YOU DOING WITH MY MARKDOWN! UH!? STOP IT"
Luckily, I have a Creative Commons certification and I somehow have
enough legal knowledge to say that the modification we have implemented
here does NOT infringe any copyright, because "the original idea" is NOT
a software, is not a content, and - in any case - it's not original
enough to be covered by copyright. Also, the "Markdown" was designed
to collaborate on text files, and connect people, so, that is not
covered by a patent. Also, this change cannot hit Microsoft in any
economical way. Mainly because they are billionaires and we in Phorge
are silly volunteers taking vitamins.
In short.
We love to read things. After this change, we simply render better README files when people
migrate offfiles coming from GitHub to Phorge.or from its nicest friend, Because we love to read thingsGitLab.
Closes T15481