aspeddro / cmp-pandoc.nvim

Pandoc source for nvim-cmp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmp-pandoc

Pandoc source for nvim-cmp

image image

Requirements

Features

Installation

packer.nvim

use {
  'aspeddro/cmp-pandoc.nvim',
  requires = {
    'nvim-lua/plenary.nvim',
    'jbyuki/nabla.nvim' -- optional
  }
}

vim-plug

Plug 'nvim-lua/plenary.nvim'
Plug 'jbyuki/nabla.nvim' "optional
Plug 'aspeddro/cmp-pandoc.nvim'

Setup

require'cmp'.setup{
  sources = {
    { name = 'cmp_pandoc' }
  }
}
require'cmp_pandoc'.setup()

Configuration (optional)

Following are the default config for the setup(). If you want to override, just modify the option that you want then it will be merged with the default config.

{
  -- What types of files cmp-pandoc works.
  -- 'pandoc', 'markdown' and 'rmd' (Rmarkdown)
  -- @type: table of string
  filetypes = { "pandoc", "markdown", "rmd" },
  -- Customize bib documentation
  bibliography = {
    -- Enable bibliography documentation
    -- @type: boolean
    documentation = true,
    -- Fields to show in documentation
    -- @type: table of string
    fields = { "type", "title", "author", "year" },
  },
  -- Crossref
  crossref = {
    -- Enable documetation
    -- @type: boolean
    documentation = true,
    -- Use nabla.nvim to render LaTeX equation to ASCII
    -- @type: boolean
    enable_nabla = false,
  }
}

Basic Syntax

Add bibliography file on YAML Header

---
bibliography: path/to/references.bib
---

Multiple bibliography files:

---
bibliography:
- path/to/references.bib
- path/to/other/references.bib
---

A YAML metadata block is a valid YAML object, delimited by a line of three hyphens --- at the top and a line of three hyphens --- or three dots ... at the bottom. A YAML metadata block may occur anywhere in the document, but if it is not at the beginning, it must be preceded by a blank line. Pandoc.org

More details, see pandoc-crossref

Limitations

  • YAML metadata inside code blocks with bibliography field enable cmp-pandoc. The parser does not check if it is inside a fenced code block.

  • Pandoc crossref support a couple options to add code block labels, but only the following style is supported:

    ```haskell
    main :: IO ()
    main = putStrLn "Hello World!"
    ```
    
    : Listing caption {#lst:code}
    

Recomendations

Alternatives

About

Pandoc source for nvim-cmp

License:MIT License


Languages

Language:Lua 100.0%