# Loss of syntax highlighting on the forum

**URL:** <https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431>\
**Category:** Site Feedback\
**Created:** [September 6, 2024, 12:20am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431 "2024-09-06T00:20:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [September 6, 2024, 12:20am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/1 "2024-09-06T00:20:50Z")

</div>

@magjac do you know why we seem to have lost syntax highlighting of inline snippets?

Here is a previous post of mine, [How to interpret Graphviz Edge coordinates from xDOT or JSON - #9 by smattr](https://forum.graphviz.org/t/how-to-interpret-graphviz-edge-coordinates-from-xdot-or-json/879/9), screenshotted below if you’re not seeing what I’m seeing:

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/c/c351656a0ca44aa47a288593984a14be539a1a71.png)

Now here is a more recent post, [How to make child nodes not interweaved - #7 by smattr](https://forum.graphviz.org/t/how-to-make-child-nodes-not-interweaved/2429/7), again screenshotted:

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/0/0ca2cac3d35f651a37b8676034ede567b0e350d1.png)

I know these posts have identical source because I went to edit and copied the text out of the first post to create the second. Any idea why syntax highlighting isn’t working?

---

<div class="post-metadata">

**Author:** ![magjac](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/magjac/32/16_2.png) [@magjac](https://forum.graphviz.org/u/magjac)\
**Post date:** [September 6, 2024, 7:32pm UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/2 "2024-09-06T19:32:29Z")

</div>

No I don’t. And I see the same as you. It’s strange since I thought these were rendered on the fly, i.e., it shouldn’t matter if the post is old or new. Here’s my attempt that also doesn’t work:

```dot
digraph {
  like -> so[with="a label"];
}

```

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [September 7, 2024, 12:17am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/3 "2024-09-07T00:17:00Z")

</div>

Mysterious. I guess the syntax highlighting isn’t a big deal as it doesn’t actually seem very accurate (the emphasised `with` is not a keyword, but the unemphasised `digraph` is).

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [September 9, 2024, 12:26am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/4 "2024-09-09T00:26:27Z")

</div>

Looking in the web inspector, I see a `data-unknown-hljs-lang="dot"` which may be a clue that dot is no longer known by the syntax highlighting library.

```html
<code class="lang-dot" data-unknown-hljs-lang="dot">digraph {
  like -&gt; so[with="a label"];
}
</code>

```

Searching for `hljs` shows up [https://highlightjs.org/](https://highlightjs.org/).

Contrast with the code snippet I just typed, which starts like:

```auto
<code class="lang-html hljs language-xml" data-highlighted="yes">

```

I suspect either the way Discourse is configuring this hljs library has changed, or hljs has dropped support for dot.

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [September 9, 2024, 12:27am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/5 "2024-09-09T00:27:21Z")

</div>

[https://highlightjs.readthedocs.io/en/latest/supported-languages.html](https://highlightjs.readthedocs.io/en/latest/supported-languages.html)

does not list ‘dot’ or graphviz.

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [September 9, 2024, 12:28am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/6 "2024-09-09T00:28:24Z")

</div>

Here’s the old feature request for highlight js to add graphviz/dot support: [Support PlantUML and Graphviz Dot · Issue #1726 · highlightjs/highlight.js · GitHub](https://github.com/highlightjs/highlight.js/issues/1726)

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [September 9, 2024, 12:30am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/7 "2024-09-09T00:30:05Z")

</div>

Here’s the docs on how Discourse admins can configure which languages get syntax highlighting (this seems configurable by us): [Configure which programming languages are available for syntax highlighting - Site Management - Discourse Meta](https://meta.discourse.org/t/configure-which-programming-languages-are-available-for-syntax-highlighting/239717)

I wonder if we ever had syntax highlighting for dot, or if it just fell back to JavaScript syntax highlighting? That would explain the `with` highlighting.

---

<div class="post-metadata">

**Author:** ![mark](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/mark/32/84_2.png) [@mark](https://forum.graphviz.org/u/mark)\
**Post date:** [September 9, 2024, 12:34am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/8 "2024-09-09T00:34:12Z")

</div>

> [@smattr](#):
>
> Here is a previous post of mine

If I right-click, “Inspect Element” on that HTML in the highlighted forum post, I see it’s using C# highlighting:

```html
<code class="hljs language-csharp" data-highlighted="yes">digraph {
  like -&gt; so[<span class="hljs-keyword">with</span>=<span class="hljs-string">"a label"</span>];
}
</code>

```

That’s surprising. I wonder how it got to C#. Maybe it was content-sniffing, or maybe it was configured to use C# for `dot`.

---

<div class="post-metadata">

**Author:** ![smattr](https://sea2.discourse-cdn.com/graphviz/user_avatar/forum.graphviz.org/smattr/32/85_2.png) [@smattr](https://forum.graphviz.org/u/smattr)\
**Post date:** [September 9, 2024, 3:59am UTC](https://forum.graphviz.org/t/loss-of-syntax-highlighting-on-the-forum/2431/9 "2024-09-09T03:59:25Z")

</div>

> [@mark](#):
>
> maybe it was configured to use C# for `dot`.

Maybe it’s matching `dot` as a prefix of `dotnet`.
