asciidoclive.nvim icon indicating copy to clipboard operation
asciidoclive.nvim copied to clipboard

An asciidoc live previewer plugin for neovim

asciidoclive.nvim

NOTE: I made this just for fun so I probably won't maintain it long term :p

An asciidoc live previewer for Neovim. Only works on recent Neovim version because it uses a relatively new nvim_add_user_command API

https://user-images.githubusercontent.com/51877647/148905771-88b7d15e-1d50-4b9b-9ef5-ab753801d141.mp4

Features

  • Live preview on each keystroke
  • Pretty stylings using sakura.css
  • honestly that's it

Requirements

Installation

i use packer so..

{
  "elianiva/asciidoclive.nvim",
  run = "cd ./app && npm ci", -- install node dependencies
  config = function()
    -- these are the default values
    require("asciidoclive").setup {
      port = 3000, -- server port
      host = "127.0.0.1" -- server host
      css  = "" -- path to custom css file, must be a local file
    }
  end
}

Usage

This plugin provides two commands:

  • AsciidocLivePreviewStart
  • AsciidocLivePreviewStop

They does exactly what they are.

Limitations

Some stuff could be improved, here's a temporary list which will probably get updated in the future.

  • [ ] automatically open the browser

  • [ ] asciidoctor.js seems to remove the first heading.. idk if that's intended or not

  • [ ] Add option to refresh on save

  • [ ] Debounce keystroke?

  • [ ] Send the entire buffer content on initial connection

  • [ ] No live scrolling

  • [ ] Only works on the buffer where you start the previewer

    Currently it behaves like this because I use nvim_buf_attach upon starting the server and it only listens to the current buffer. It should probably listen to any buffer with the same filename, but eh, it fits my need atm

  • [ ] TBD

PR's welcome, btw.

Acknowledgement


If you found any issue / something missing, just open an issue (or better, make a PR :)