The idea is to use crater to take in user supplied Markdown and convert it to usable html to one day be used in crescent (and maybe any other lua app that needs safe markdown -> html). The idea of decoupling this from the main code is to allow modules to be added while the rest of the site is still running (to help with runtime and avoid doing things like putting module code in sql databases)
This is still in development, but will hopefully be able to do the all of the following successfully:
- It converts the markdown safely to html using hoedown
- This is followed by a sanitization process to ensure that no malicious code is put up on the server
- It needs some wiki-specific things (like easy URL linking)
- The above are crucial, but I want it to be easily configurable/extendable via modules (such as allowing syntax highlighting or executing code blocks in sandboxed environments)
It's currently just a POC to see if it's possible to call out to an internal api and use it for creating usable HTML.
You can build and run using the Dockerfile! Or, if you have openresty and luarocks (v2.2.2+ required) installed locally, you can install all the dependencies as follows:
luarocks build --only-deps crater-dev-1.rockspec
and then fire up nginx using nginx.conf
The api is fairly straightforward. It just takes a POST request on
http://localhost:80 with a request body as follows:
markdown=##This is my sweet markdown LOOK AT IT! Isn't it **beautiful?**
and returns an html response. The API might change as I read more into best practices for internal APIs.