konnov / tlaplus-highlightjs

Syntax highlighting for TLA+ in highlightjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax highlighting for TLA+ in highlightjs

badge

This repository contains a syntax highlighting file for TLA+ with highlightjs. You can use it to highlight TLA+ snippets in your blog posts. You can check how it looks like in my blog called Protocols Made Fun, which runs on Github pages.

How to use it?

You have to load highlightjs and the syntax file as JavaScript somewhere in your blog HTML header. For instance, in Jekyll, I am extending the file _includes/custom-head.html (which is a copy of the respective file from the minima theme) with the following lines:

  <link rel="stylesheet"
        href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/isbl-editor-light.css"></link>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
  <script
    src="https://cdn.jsdelivr.net/gh/konnov/tlaplus-highlightjs/tlaplus-minified.js">
  </script>
  <script>hljs.highlightAll();</script>

Once highlightjs and tlaplus-highlightjs are properly loaded, you can simply type TLA+ in Markdown:

```tla
---- MODULE Counter ----
VARIABLE x
Init == x = 0
Next == x' = x + 1
====
```

About

Syntax highlighting for TLA+ in highlightjs

License:MIT License


Languages

Language:JavaScript 100.0%