GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
I think the current highlighting of OCaml code is really subpar. It should be easy to improve it, either by
We have thus far avoided anything requiring server side computations
because we haven't settled on a server and wanted to simplify deployment.
Xavier just approved use of the ocaml.org domain, so that moves us one step
closer to finalizing a hosting solution. It should be figured out soon, and
we can then start doing fancier things.
question on StackOverflow  was answered with a suggestion of google's
prettify with the lang-ml.js extension. I haven't had a chance to try it
yet. Do you know what's best?
A quick note as well. There at least 2 OCaml tools to colorize OCaml code:
caml2html's output seems fine to me, and iirc. xmlm is already a dependency of ocaml.org so ocaml-cow would be fine as well (it looks a bit overkill for simply syntax highlighting, but then maybe Cow's escaping capabilities could be useful for ocaml.org?).
That said, now that I'm looking at it on the website, I agree that there are not much differences between the various rendering (the current one and Pygments for example). The difference I observed are on the rendering of the "minimum viable snippet" that I added in this commit; apparently the current highlighter doesn't cope so well with several non-;;-separated phrases.
Ashish, I'm not sure client-side rendering is the best option. The pros is that it's easy to deploy and keeps the HTML rather clean (you have the non-rendered source, which is nice), but the cons is that it makes me cringe at the idea of CPU time being wasted by all the readers rendering the code each time they visit the page, instead of one static server-side computation (one lesser issue is that the rendering is not done in syndication feed readers, if you publish some of your content in RSS or Atom format; I don't think ocaml.org is concerned with that). I've considered both options for gagallium and finally decided in favor of server-side rendering.
@gasche: I am working on integrating your patch. I will fix the highlighting of the snippet at the same time.
The current highlighting engine is a quick hack to remove the slow external program and have something that looks reasonable. There is no doubt that it can be improved. Maybe Cow is a good solution — more details would be welcome (I do not have time to look deeper into it ATM).
See also #286