As far as I know Discourse uses Highlight.js, which supports Prolog syntax highlight in code blocks.
Would be awesome to enable it on the forum.
I cannot find any relevant setting. The default language may be specified, but without support for Prolog in the first place that will not help As this site is kindly hosted by Discourse, we cannot add it ourselves. I’ll open a topic on Discourse meta.
I think I just found a place in the admin settings I can add languages to highlight; just tried adding Prolog to the list.
(for other admins: https://swi-prolog.discourse.group/admin/site_settings/category/all_results?filter=highlighted%20languages)
I do not see any effect though
test :- fail.
test :- findall(x, y, z).
Yeah…it seemed like in the preview it was highlighting variables & comments, but I think maybe it needs to reload some cache or something to include the other language
foo(X). % a comment
And looking at the source, I think that just might be all highlight.js does: https://github.com/highlightjs/highlight.js/blob/cd73c87b85d3b5e65584fdc4016d95a47ffa94c5/src/languages/prolog.js
foo("foo").
bar(`bar`).
baz(0'a).
quux(123).
% seems to be the only things it highlights
This seems to work. It only doesn’t try to do built-in predicates. Anyway, this is better than nothing. Shall we set this as default language and maybe remove some of the others?
p(X) :- q(X, 'Hello world').
fail.
A bit related, should we open a ticket for a way to type :- at the end of a line, at least in code blocks?
That sounds good; I tried turning a setting on to automatically highlight the code, but I’m not sure how it chooses what to use.
Yeah, the auto-complete inside code blocks is frustrating, probably worth opening a ticket for.
The answer has arrived Set emoji autocomplete min chars
to 3.