jghauser/auto-pandoc.nvim

github github
markdown plugin
star 6
stars
alert-circle 0
open issues
users 1
subscribers
git-branch 1
forks
CREATED

2021-05-16

UPDATED

6 months ago

packer

require('packer').startup(function()
  use 'jghauser/auto-pandoc.nvim'
end)

paq

require "paq" { 
  'jghauser/auto-pandoc.nvim'
}

auto-pandoc.nvim

This plugin allows you to easily convert your markdown files using pandoc. It uses a custom key in the yaml block at the beginning of the markdown file to set pandoc settings. Converting your file then just requires running the supplied command (see below under configuration). This allows for quickly updating the file without having to supply file formats and other settings.

Installation

This plugin requires neovim 0.5 and depends on the plugin plenary.nvim.

Packer:

use {
  'jghauser/auto-pandoc.nvim',
  requires = 'nvim-lua/plenary.nvim',
  config = function()
    require('auto-pandoc')
  end
}

Configuration

I added the following keymap to my ftplugin/markdown.lua. It will save the file and execute pandoc on go. Adapt to your preferences.

vim.api.nvim_buf_set_keymap('0', 'n', 'go', ':silent w<bar>lua require("auto-pandoc").run_pandoc()<cr>', {noremap = true, silent = true})

Use

Use the pandoc_ key in the yaml block to set options supplied to the pandoc command. The to field defines the output format, other fields follow the naming convention of the pandoc cli program.

---
pandoc_:
  - to: pdf
  - defaults: academic
---

Todo/limitations

  • Plugin doesn't currently deal well with spaces in file and directory names.