Skip to content
This repository has been archived by the owner on Dec 25, 2022. It is now read-only.
/ markdown.nvim Public archive

Markdown previewer plugin written in Lua using libuv

Notifications You must be signed in to change notification settings

Alighorab/markdown.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Markdown.nvim

  • A markdown preview plugin written in Lua.
  • It uses luv library which provides access to the multi-platform support library libuv in Lua code.
  • It also uses grip as a server to translate .md to .html.

Requirements

  • You must have grip installed in your system, to do so, simply:
pip install grip

Installing

With packer.nvim

use("Alighorab/markdown.nvim")

or

use("Alighorab/markdown.nvim", {
    config = require("markdown").setup({
        server = {
            port = "4000", -- Port number
        },
        browser = {
            command = "firefox" -- Choose your browser
            args = {} -- arg list if you need
        }
    })
})

Options

Default options are:

require("markdown").setup({
    server = {
        enable = true,
        port = "${port}", -- Choose port automatically (recommended) or can be any free port
    },
    browser = {
        enable = true,
        command = "firefox",
        args = {}, -- comma-separated string, e.g., { "-P", "Markdown", "--new-instance" }
    }
})

Usage

This plugin is still in early stages, you can define a keymap to use it

local markdown = require("markdown")

vim.keymap.set("n", "<leader>ms", function()
    markdown.spawn_server()
    markdown.spawn_browser()
end)

vim.keymap.set("n", "<leader>mk", function()
    markdown.kill_server()
    markdown.kill_browser()
end)

I still prefer not to launch browser on opening any markdown but it will be an option soon.

TODO

  • Close server and browser on buffer close
  • Ability to choose free port automatically
  • Add autostart option
  • See changes at realtime without saving
  • Syncronize scrolling

About

Markdown previewer plugin written in Lua using libuv

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages