omd icon indicating copy to clipboard operation
omd copied to clipboard

Support for code highlighting

Open shonfeder opened this issue 3 years ago • 5 comments

Requested in https://github.com/ocaml/omd/issues/236#issuecomment-826293442. This should probably be implemented in a lightweight way that takes advantage of the clean extension mechanism we want (but don't yet have) ;)

shonfeder avatar Apr 25 '21 21:04 shonfeder

There is a project called lowlight which integrates highlight.js with vdoms. It might be useful to do the same here where there is another project for integrating with jsoo vdom implementations.

ghost avatar Jun 28 '21 04:06 ghost

Hi, I am using Omd to make a static site generator. One of the features I wanted for my static site generator was syntax highlighting, so I went and implemented it myself. I have published the textmate-language package for processing TextMate grammars on OPAM. I would love to work with the maintainers of Omd to integrate my existing work into Omd.

alan-j-hu avatar Jul 11 '21 17:07 alan-j-hu

Hi, @alan-j-hu, thanks! I'll take a look at your package to get an idea. As @shonfeder suggests, this might be a good opportunity to think about extensions more concretely.

sonologico avatar Jul 14 '21 21:07 sonologico

I guess one place to start is with this question:

Is it (a) sufficient for our purposes that "extension" be through OCaml library APIs, or (b) do we need a plugin system that would allow different external executables to serve as extension mechanisms?

My current inclination is that (a) will suffice for current needs. The cost is that using a plugin means that you are either leveraging omd as a library, or you are building a new executable. Would this be satisfactory for your current needs @alan-j-hu?

If (a) is the right target for now, I propose we expore implementing it via a functorial interface. Later, we might consider adding something which is midway between (a) and (b) via ocaml_plugin (this would allow dynamically loading ocaml modules as plugins, but wouldn't work with arbitrary executables).

shonfeder avatar Jul 17 '21 14:07 shonfeder

Yes, accessing the extension mechanism through the OCaml library should be sufficient for my needs.

alan-j-hu avatar Jul 17 '21 17:07 alan-j-hu