- From: Fuqiao Xue via GitHub <sysbot+gh@w3.org>
- Date: Thu, 17 Feb 2022 08:56:26 +0000
- To: public-i18n-archive@w3.org
xfq has just submitted a new pull request for https://github.com/w3c/i18n-drafts:
== Try adding syntax highlighting ==
This PR attempts to add syntax highlighting to our code to improve the readability. The currently supported languages are HTML/XML, CSS, JavaScript, HTTP, and JSON, which should basically meet our needs. It is also easy to extend if needed.
Here is a comparison:
<img width="1035" alt="before" src="https://user-images.githubusercontent.com/2863444/154439832-0451646b-aee7-43bb-b034-ec6281ee4787.png">
<img width="1032" alt="after" src="https://user-images.githubusercontent.com/2863444/154439853-8fa61de1-ac6a-4339-af12-68321e0e0b92.png">
(Specific colors can be customized if needed.)
-----
The code changes are few and simple. Just use the [recommended way to mark up a code block](https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element) (a `<pre>` element with a `<code>` element inside), like so:
```html
<pre><code class="language-css">p { color: red }</code></pre>
```
It uses Prism, which is a lightweight syntax highlighter invented by Lea Verou.
See https://github.com/w3c/i18n-drafts/pull/347
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 17 February 2022 08:56:28 UTC