Blog of Raivo Laanemets

Stories about web development, freelancing and personal computers.

Prolog highlighter for highlight.js


highlight.js is a JavaScript-based syntax highlighter (good for processing snippets in a browser!). For a long time it did not support Prolog syntax but the last release (8.5) has it now. Writing the initial code for the Prolog highlighter was quite straightforward but the language relevancy detection did not work well at first (some false positives) and required some tuning. However, it got resolved and the Prolog highlighter is now merged.

Example code:

append([],L,L).
append([H|T],L2,[H|L3]):-
	append(T,L2,L3).

% A comment.

:- append(['hello', ' '], ['world'], List), writeln(List).

If you have JavaScript enabled in the browser then you should see the snippet highlighted in colors.


Comments

No comments have been added so far.

Email is not displayed anywhere.
URLs (max 3) starting with http:// or https:// can be used. Use @Name to mention someone.