Makeup lexer for JSON - makeup_json

makeup_json is a makeup lexer for json. It generates tags very close to Pygments. I have used makeup_elixir code as base and modified it to create this.

iex(1)>json = """
{
  "key": "value"
}
"""

iex(2)>Makeup.highlight(json, lexer: Makeup.Lexers.JsonLexer) |> IO.puts()
# will generate the below tags
<pre class="highlight"><code><span class="p">{</span><span class="w">
  </span><span class="nt">&quot;key&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;value&quot;</span><span class="w">
</span><span class="p">}</span><span class="w">
</span></code></pre>

Please share any feedback or improvements to the lexer.

6 Likes