We just added DNS zone file syntax highlighting to our site. Heres’ an example:

$ORIGIN example.com
@       IN      SOA     ns1.example.com.      root.example.com. (
                                              2015071101
                                              14400
                                              3600
                                              1209600
                                              86400 )
@      NS  ns1.isp.com.
@      NS  ns2.isp.com.

@      A   192.168.0.2
mail   A   192.168.0.3

@      MX  10 mail.example.com.

The syntax highlighting is being done using highlight.js.

If you’re interested in trying out highlight.js, you can download it, or use one of the CDNs listed on their download pages.

The CDNs listed on their download page provide support for the 22 most commonly highlighted languages. Unfortunately, DNS zone files didn’t make the cut, so we’ve posted a copy to CloudFlare’s CDN that you’re welcome to use. This copy includes support for the 22 most commonly highlighted languages, plus DNS zone files.

Feel free to use this copy for your website:

<link rel="stylesheet" href="https://cdn.dnscheck.co/highlight.js/8.7/styles/default.css">
<script src="https://cdn.dnscheck.co/highlight.js/8.7/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>

Once you’ve inserted the above code into your site, any code blocks that are enclosed with <pre> and <code> will automatically be highlighted. For example, the above code block was generated with:

<pre>
  <code>
    <link rel="stylesheet" href="https://cdn.dnscheck.co/highlight.js/8.7/styles/default.css">
    <script src="https://cdn.dnscheck.co/highlight.js/8.7/highlight.pack.js"></script>
    <script>hljs.initHighlightingOnLoad();</script>
  </code>
</pre>