Skip to content

UUGTech/markdown-termaid.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markdown-termaid.nvim

Preview Markdown Mermaid fenced blocks as ASCII diagrams through the termaid CLI.

Requirements

  • Neovim 0.9+
  • termaid on $PATH
  • Optional: hover.nvim

Installation

With lazy.nvim:

{
  "UUGTech/markdown-termaid.nvim",
  ft = { "markdown" },
  cmd = { "TermaidPreview" },
  main = "markdown_termaid",
  opts = {
    cmd = { "termaid" },
    ascii = true,
    keymaps = {
      preview = "<leader>ma",
    },
    integrations = {
      hover = true,
    },
  },
}

Usage

Put the cursor inside a Markdown Mermaid fence and run:

:TermaidPreview

or configure a keymap:

require("markdown_termaid").setup({
  keymaps = {
    preview = "<leader>ma",
  },
})

hover.nvim

The plugin ships a hover.nvim provider. Require it from hover.nvim's init callback so it participates in the normal provider priority order:

require("hover").setup({
  init = function()
    require("hover.providers.lsp")
    require("markdown_termaid.hover")
  end,
})

The provider is named Mermaid and defaults to priority 1100.

Configuration

Defaults:

require("markdown_termaid").setup({
  cmd = { "termaid" },
  ascii = true,
  border = "rounded",
  auto_install = false,
  install_commands = {
    { "uv", "tool", "install", "termaid" },
    { "python3", "-m", "pip", "install", "--user", "termaid" },
    { "pip3", "install", "--user", "termaid" },
    { "pip", "install", "--user", "termaid" },
  },
  command = "TermaidPreview",
  keymaps = {
    preview = nil,
  },
  integrations = {
    hover = false,
  },
  hover = {
    name = "Mermaid",
    priority = 1100,
  },
})

About

Preview Markdown Mermaid fenced blocks as ASCII diagrams through the termaid CLI.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages