Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I wrote it up at http://chriswarbo.net/projects/activecode

The process I use is very simple: shell commands are written as attributes of code blocks, and during rendering the content of the code blocks will be piped into those commands. Hence we can run a bash script by giving its code block a pipe="bash" attribute, python scripts by using pipe="python", haskell by using pipe="runhaskell", and so on for anything that can be called from a shell.

This is all powered by a couple of scripts based on Pandoc.

If you want to see some examples, click the "View Source" links at the bottom of my site. The pages I linked to above are quite complex, but some simpler examples are:

- The blog post listing comes from a `find` command http://chriswarbo.net/blog.html

- Images can be embedded using base64 URIs http://chriswarbo.net/blog/2015-06-06-more_git.html

- Code snippets can be checked, and we can even include real error messages http://chriswarbo.net/blog/2015-11-12-calculating_arity.html



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: