jbyuki/carrot.nvim

github github
markdown-/-latex
star 7
stars
alert-circle 0
open issues
users 1
subscribers
git-branch 0
forks
CREATED

2022-05-06

UPDATED

15 days ago


carrot.nvim license version

Markdown evaluator for Neovim Lua code blocks.

This is still work-in-progress but the main code evaluation functionnalities should be working.

The plugin will detect the code blocks under the cursor using treesitter's query mechanism, execute it, and show the results directly in the markdown.

It tries to be not intrusive. It won't redefine print() to redirect the result, it uses a subprocess neovim to evaluate the code in a sandboxed safe environnement.

It also tries to keep the spirit of Markdown files and show results in a simple but pleasing way.

carrot screenshot

Prerequisites

Make sure that the markdown parser is installed with:

local buf = vim.api.nvim_create_buf(false, true)
local parser = vim.treesitter.get_parser(buf, "markdown")
assert(parser, "The markdown parser is not installed.")
print("OK")
OK

Install

Install using your prefered method:

Usage

  • Hover the cursor over a lua code block
  • Execute :CarrotEval

Examples