Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ehsundar/obsidian-runner
Run code blocks inside any Markdown doc, including Obsidain docs
https://github.com/ehsundar/obsidian-runner
golang markdown obsidian-md
Last synced: 15 days ago
JSON representation
Run code blocks inside any Markdown doc, including Obsidain docs
- Host: GitHub
- URL: https://github.com/ehsundar/obsidian-runner
- Owner: ehsundar
- Created: 2022-11-30T15:35:27.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-30T16:00:37.000Z (almost 2 years ago)
- Last Synced: 2024-10-10T12:43:33.711Z (about 1 month ago)
- Topics: golang, markdown, obsidian-md
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Obsidian Runner
`obsidian-runner` CLI helps you format and run code blocks embedded inside any valid Markdown
document and store results below the code block.### Supported Languages
- Go
### Showcase
`obsidian-runner` compiles and runs any go code. It also `gofmt`s your code block
in-place.```go
package mainimport "fmt"
func main() {
fmt.Println("results right below")
}
```
```result
results right below
```This small code block is also runnable but needs `goimports` tool installed to
remove unused imports.```go
fmt.Println("results generated by obsidian-runner!")
```
```result
results generated by obsidian-runner!
```## Usage
Standalone:
```shell
obsidian-runner -mdfile README.md
```With Obsidian:
1. Install [obsidian-shellcommands](https://github.com/Taitava/obsidian-shellcommands) plugin
2. Install obsidian-runner:
```shell
go install github.com/ehsundar/obsidian-runner@latest
```
3. 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.
4. 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.