Skip to content

dsanson/cmp-pandoc.nvim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cmp-pandoc

Hacked up version

This is a hacked up and simplified version of cmp-pandoc. I've removed support for bibtex files, and only support json files. I've also removed support for detecting the bibliography in the YAML front matter. The bibliography is set globally using the setup function instead. I've also (temporarily) removed support for cross-reference completion.

require'cmp_pandoc'.setup({
  filetypes = { "pandoc", "markdown", "rmd", 'markdown.pandoc', 'markdown.pandoc.carnap' },
  bibliography = {
    path = '/Users/desanso/Documents/zotero.json',
    documentation = true,
  },
})

Original README

Pandoc source for nvim-cmp

image image

Requirements

Features

Installation

use {
  'aspeddro/cmp-pandoc.nvim',
  requires = {
    'nvim-lua/plenary.nvim',
    'jbyuki/nabla.nvim' -- optional
  }
}
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

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Lua 100.0%