Categorygithub.com/mrWinston/mdrun.nvim
modulepackage
0.0.0-20240619071011-06ef88ca4bf9
Repository: https://github.com/mrwinston/mdrun.nvim.git
Documentation: pkg.go.dev

# README

mdrun.nvim

Markdown snippet runner for neovim.

Features

  • evaluate markdown codeblock in the language of your choice
  • stream stdin and stdout to other codeblocks in real time
  • define env-vars per markdown section
  • run snippets either directly or in a docker/podman container
  • define custom runners for languages not supported out of the box

Installation

Configuration Options in LUA

require('mdrun').setup({
  stop_signal = "SIGINT", -- Signal to send when attempting to stop a process. one of: [SIGKILL, SIGINT]

})

Supported Languages

Shell (bash, zsh, sh)

Example 1:

echo "I'm in $(pwd)"
I'm in /usr/share

Example 2:

Config:

KeyDefaultDescription
CWDNeovims current workdirworking directory of the shell commands to run
CONTAINERNoneDocker/podman container in which to run the shell command.

Golang (go)

Example 1:

one := 1
two := 2
pi := math.Pi
fmt.Printf("One plus Two is: %d\n", one + two)
fmt.Printf("Pi is: %f\n", pi)
One plus Two is: 3
Pi is: 3.141593

Config:

KeyDefaultDescription
FULL_FILEfalseWeather or not the codeblock specifies the full main.go or just the contents of the main function

Todo

LanguageDone
Bash/ShellYes
CYes
C++Yes
C#No
ClojureNo
ElixirNo
F#No
GoYes
HaskellYes
JavaNo
JavaScriptNo
JuliaNo
LuaYes
OCamlNo
Perl/Perl6No
Python3No
RNo
RubyNo
RustYes
ScalaNo
TypeScriptNo
f = vim.api.nvim_get_runtime_file("*/mdrun.lua", false)
vim.print(f)

Result: <nil>

# Packages

No description provided by the author

# Functions

AddStreamer adds the streamer to the list of streamers, but only if it's not already running.
No description provided by the author
Configure receives config table from lua and configures the runners accordingly.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
GetStreamerWithID returns the streamer with the given ID.
No description provided by the author
No description provided by the author
KillCodeblock stops the process associated with a running codeblock.
No description provided by the author
NewTargetCodeblock create a new out codeblock for the given codeblock and returns it.
No description provided by the author
No description provided by the author
revive:disable:function-length revive:disable:cognitive-complexity revive:disable:cyclomatic RunCodeblock looks up the codeblock under the cursor and runs it according to the configuration.
No description provided by the author
WrapInContainer modifies a given command so that it is run in the container runtime specified in the config.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
ContainerRuntimeDocker is the name of the docker container runtime.
ContainerRuntimePodman is the name of the podman container runtime.
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
go:generate gomodifytags -file ./config.go -all -add-tags "json,yaml" -transform snakecase -override -w -quiet.
Streamer wraps the execution of an exec.Cmd and allows access to its stdin/out/err while it is running.
No description provided by the author