obsidian-runner
CLI helps you format and run code blocks embedded inside any valid Markdown
document and store results below the code block.
- Go
obsidian-runner
compiles and runs any go code. It also gofmt
s your code block
in-place.
package main
import "fmt"
func main() {
fmt.Println("results right below")
}
results right below
This small code block is also runnable but needs goimports
tool installed to
remove unused imports.
fmt.Println("results generated by obsidian-runner!")
results generated by obsidian-runner!
Standalone:
obsidian-runner -mdfile README.md
With Obsidian:
- Install obsidian-shellcommands plugin
- Install obsidian-runner:
go install github.com/ehsundar/obsidian-runner@latest
- Add this command
PATH='$PATH:/opt/homebrew/bin:/Users/ehsan/go/bin' /Users/ehsan/go/bin/obsidian-runner -mdfile {{file_path:absolute}}
. you need to replace your username and maybe change path based on your OS. - Use
cmd+p
to run obsidian commands. You may run your shell-command from there.
Warning
Do not use shell-command events to run obsidian-runner
automatically. May
cause inconsistency in the contents of the final result MD file.