Skip to content

LinuxSuRen/md-exec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codacy Badge Codacy Badge GitHub All Releases

Feature

  • Support to run shell, python, Golang, and Groovy
  • Load multiple Markdown files

Usage

md-exec could exec the commands in the Markdown files. For instance, it will execute those commands which in Markdown block via mde README.md

#!title: Print ip info
ifconfig

Run in different shells:

#!title: Run in zsh
readlink /proc/$$/exe
#!title: Run in dash
readlink /proc/$$/exe

Variable input support

In some use cases, we need to change the variables or command line flags. Try the following demo:

#!title: Variable Input Hello World
name=linuxsuren
echo hello $name

Run in long time

#!title: Run long time
for i in 1 2 3 4 5
do
    echo $i
    sleep 1
done

Run Python Script

#!title: Python Hello World
print('hello python world');

Run Golang

#!title: Golang Hello World
fmt.Println("hello golang")

items := []int{1,2,3,4}
for _, item := range items {
    fmt.Println(item)
}

Run Groovy

#!title: Groovy Hello World
class Foo {
    void hello(){
        println "hello"
    }
}
new Foo().hello()

Limitation

Please make sure the Markdown files meet Linux end-of-line. You could turn it via: dos2unix your.md