echo "Run bash scripts inside markdown files!"npm -g i mdexecRun with npx if you prefer:
npx mdexecRun 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.
Sometimes documentation also offers a command to execute.
Would be nice exec such scripts from terminal.
Some IDE's already offers to execute scripts.
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
done
echo "for now,"
echo "only bash is supported"- Intellij plugin
- (Abandoned) VSCode plugin
- Jupyter notebooks