# How do you get syntax highlighting in comments that aren’t obviously Prolog?

Can you be more specific or give me some examples? I know the examples will look wrong but then I will have an idea of what you seek.

If that doesn’t work you can post an image and then delete it if an acceptable answer is found.

See my comment above.I copied an expression from j4n_bur53’s comment where it had syntax highlighting.

Edit: never mind, it’s not important. The highlighted comment was being treated as Prolog altough it’s not. It’s probably more confusing if non-Prolog is highlighted as if it was Prolog

1 Like

I take it this is what you seek:

if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s  ⊢ ⊥ .


To read what follows you will need a good understanding of HTML, Markdown, how Discourse creates post and Internet browsers in development mode.

The first thing I did when was to use the Discourse raw feature when editing post to see the raw text.
In plain English, Discourse keeps two copies of a post in the PostgreSQL database. One is in a field called raw and the other is in a field called baked. The raw field holds what you enter when you edit a post. The baked field holds the post after it has been baked; I don’t know if the method is from Ruby, Ruby-on-Rails or Discourse. Baking a post is the process of parsing the raw post and converting the Markdown, etc. into valid HTML.

So to see the raw text for a post, select the post, click the ellipsis (…), then click the raw text button (Not the wrench, which I think is limited to admins).

Doing so for the noted post will reveal that it was formatted using the indent method as opposed to the Markdown fence , or with HTML directly in the text.

This is the text

if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s ⊢ ⊥ .

This is the text indented.

if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s  ⊢ ⊥ .


This is the text with a Markdown fence.

if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s  ⊢ ⊥ .


This is the text with <pre><code> and </code></pre> HTML

if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s  ⊢ ⊥ .


Notice they are all the same.

Now that it has been demonstrated how to get the text to format using various means, how does one get the text to appear formatted and quoted.

So if one takes the indented text and just quotes it, it displays as

if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s  ⊢ ⊥ .


As raw text it look like

>     if T ⊆ Horn_1, if s ∈ Horn_2, then if T ⊧ ¬s then T ∪ s  ⊢ ⊥ .


Now if you see some really complex HTML on a page and the raw is showing HTML coded into the text then using an Internet browser use the inspect option to see the HTML. For Google Chrome on Windows it is accessed as a right mouse click, e.g.

HTH

1 Like

Thanks. That’s what I was looking for initially, but I figured it doesn’t make a lot of sense, for the reason I say in my edit to my last comment above: the syntax highlighting in your reply is Prolog syntax highlighting applied to an expression that is not Prolog. It would make more sense to have something that highlights mathematical symbols like ⊆ or ⊥, but that would be too much work and anyway there is no convention for that sort of thing.

But I’ll read your long and technical answer with interest should you feel inclined to post it

MathJax works on this site. See: Post for testing installed component themes and plugins

Here is a MathJax example with color.

\color{red}{x} \color{green}{+} \color{blue}{y}

Here is the raw text

$$\color{red}{x} \color{green}{+} \color{blue}{y}$$
`
1 Like