Project

eceval

0.0
No commit activity in last 3 years
No release in over 3 years
Evaluates Ruby code embedded in markdown, merging results
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 0.6
 Project Readme

Eceval

Embedded code evaluator. A command-line tool that evaluates Ruby code embedded in markdown, and outputs the markdown with the results of evaluation merged in to it.

⚠️ DANGER ⚠️

NEVER RUN THIS WITH UNTRUSTED INPUT. This gem does arbitrary code execution, by design. To put it another way, this is a hacker's dream, and a security nightmare. Never run this on any markdown document unless you are 100% sure that the document is safe.

But Why Tho?

Eceval can be used to augment README.md files with the real results of running the code examples. It ensures that the examples run correctly, and show correct output.

For example, if you ran eceval README.md on this file, it would output the whole markdown file, but this following code block ...

1 + 1 #=>
6 / 0 #=> !!!

... would be augmented to be the same as this code block:

1 + 1 #=> 2
6 / 0 #=> !!! ZeroDivisionError: divided by 0

Usage

Install the eceval gem using Bundler or just gem install eceval.

Then run the eceval binary to see the help documentation:

eceval --help

Contributing

Open PRs and issues on GitHub.

  • It would be cool to get this working for other languages, but right now it's hard-coded for Ruby.

  • Sandboxing would be good, but I don't know how feasible it is.

  • Should handle multi-line STDOUT output

License

The gem is available as open source under the terms of the MIT License.