mdexec
v0.2.0
Published
run bash scripts from markdown files
Readme
mdexec
echo "Run bash scripts inside markdown files!"Installing
npm -g i mdexecRun with npx if you prefer:
npx mdexecUsage
Run the first bash script contained in a README.md file in current directory:
mdexec 0List all scripts from README.md:
mdexec
# or mdexec -lPass directory where to run and markdown file name, run the 4th script:
mdexec -f steps/intro.md -d ../example -s 3Run mdexec -h for more details.
Why
Sometimes documentation also offers a command to execute.
Would be nice exec such scripts from terminal.
Some IDE's already offers to execute scripts.
How
Add some script blocks in your markdown document:
# Obi-Wan jumps
echo "Hello there!"# Grievous salutes
echo "General Kenobi!"for i in `ls`
do
echo $i
doneThen mdexec will present them:
## How
[0]:
# Obi-Wan jumps
echo "Hello there!"
[1]:
# Grievous salutes
echo "General Kenobi!"
[2]:
for i in `ls`
do
echo $i
doneWhat about other shells
echo "for now,"
echo "only bash is supported"Further reading
- Intellij plugin
- (Abandoned) VSCode plugin
- Jupyter notebooks
