Syntax highlight with jekyll

on a the as events politely as an their into had met into his no findings. Particular one stupid.

author image
Chapman

Software Engineer

Last updated on October 2, 2020, at 1:36 a.m. ET

Posted on 2018-12-06 02:14:30 +0000

Markup

To use this language, use one of the following classes:

  • "language-markup"
  • "language-html"
  • "language-xml"
  • "language-svg"
  • "language-mathml"
  • "language-ssml"
  • "language-atom"
  • "language-rss"

Empty tag

<p></p>

Tag that spans multiple lines

<p
>hello!
</p>

Name-attribute pair

<p></p>

Name-attribute pair without quotes

<p class=prism></p>

Attribute without value

<p data-foo></p>
<p data-foo ></p>

Namespaces

<html:p foo:bar="baz" foo:weee></html:p>

XML prolog

<?xml version="1.0" encoding="utf-8"?>
<svg></svg>

DOCTYPE

<!DOCTYPE html>
<html></html>

CDATA section

<ns1:description><![CDATA[
  CDATA is <not> magical.
]]></ns1:description>

Comment

<!-- I'm a comment -->
And i'm not

Entities

&amp; &#x2665; &#160; &#x152;

Embedded JS and CSS

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8" />
  <title>I can haz embedded CSS and JS</title>
  <style>
    @media print {
      p { color: red !important; }
    }
  </style>
</head>
<body>
  <h1>I can haz embedded CSS and JS</h1>
  <script>
  if (true) {
    console.log('foo');
  }
  </script>

</body>
</html>

Invalid HTML

<l </ul>

Multi-line attribute values

<p title="foo
bar
baz">

XML tags with non-ASCII characters

<Läufer>foo</Läufer>
<tag läufer="läufer">bar</tag>
<läufer:tag>baz</läufer:tag>

Share on

Tags

Subscribe to see what we're thinking

Subscribe to get access to premium content or contact us if you have any questions.

Subscribe Now