Just noticed there is a whole bunch of projects focusing on executable readmes.
Can you remind me what’s the common consensus on attributes for code blocks?
I think Runme has the closest form to what was discussed regarding consistent attribute syntax.
Anyway it may be of interest to everyone here on the different styles floating around regarding executable code blocks.
The two common applications seen so far below is:
- Command Runners similar in purpose to GitHub - casey/just: 🤖 Just a command runner but is blended into markdown documents
- Self verifying calculations in markdown documents
Runme
This is for executable rundocs. In a sense, this is similar to justfile
and Pryrite
# My Project
## Install
To initiate the installation process, start by updating Brew dependencies with the following command:
```sh { name=update-brew }
brew update
...
```
Pyrite
Pryrite, interactively execute shell code blocks in a markdown file. So this is similar to runme
# Hello world
Lets try some examples
* Hello world
```shell
echo "Hello world"
```
* Try a command with some output, say list files in this directory
```shell
ls -l
```
* How about setting a variable and using it later
```shell
TMPDIR=/tmp/
```
* List TMPDIR
```shell
ls -l $TMPDIR
```
* Running sudo
```shell
sudo whoami
```
RunMD
This focuse on running code snippet and rendering output
```javascript --run
const foo = 'def';
```
```javascript --run alpha
const foo = 'alpha';
```
```javascript --run beta
const foo = 'beta';
```
Markdown Code Runner
Python package that runs code blocks and updates the output in-place
This is an example code block:
<!-- CODE:START -->
<!-- print('Hello, world!') -->
<!-- CODE:END -->
<!-- OUTPUT:START -->
This content will be replaced by the output of the code block above.
<!-- OUTPUT:END -->
Markdown Exec
Utilities to execute code blocks in Markdown files. For example, you write a Python code block that computes some HTML, and this HTML is injected in place of the code block.
```python exec="on"
print("Hello Markdown!")
```