feat(neovim): install pandoc
This commit is contained in:
parent
339840a602
commit
bfa0f77296
3 changed files with 47 additions and 1 deletions
|
|
@ -1,2 +1,33 @@
|
|||
vim.o.conceallevel = 1
|
||||
vim.o.textwidth = 80
|
||||
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
local opened = false
|
||||
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'RenderCompileSuccess',
|
||||
callback = function(args)
|
||||
if args.data.bufnr ~= buf then
|
||||
return
|
||||
end
|
||||
local html = args.data.output
|
||||
if not opened and html and html ~= '' then
|
||||
opened = true
|
||||
vim.system({ 'xdg-open', html })
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('BufWritePost', {
|
||||
buffer = buf,
|
||||
callback = function()
|
||||
local ok, render = pcall(require, 'render')
|
||||
if ok then
|
||||
render.compile(buf)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>t', function()
|
||||
require('render').compile(buf)
|
||||
end, { buffer = true })
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ return {
|
|||
},
|
||||
{
|
||||
'barrettruth/render.nvim',
|
||||
ft = { 'typst', 'tex' },
|
||||
ft = { 'typst', 'tex', 'markdown' },
|
||||
before = function()
|
||||
vim.g.render = {
|
||||
providers = {
|
||||
|
|
@ -432,10 +432,24 @@ return {
|
|||
end,
|
||||
clean = { 'latexmk', '-c' },
|
||||
},
|
||||
pandoc = {
|
||||
cmd = { 'pandoc' },
|
||||
args = function(ctx)
|
||||
local output = ctx.file:gsub('%.md$', '.html')
|
||||
return { ctx.file, '-s', '--embed-resources', '-o', output }
|
||||
end,
|
||||
output = function(ctx)
|
||||
return ctx.file:gsub('%.md$', '.html')
|
||||
end,
|
||||
clean = function(ctx)
|
||||
return { 'rm', '-f', ctx.file:gsub('%.md$', '.html') }
|
||||
end,
|
||||
},
|
||||
},
|
||||
providers_by_ft = {
|
||||
typst = 'typst',
|
||||
tex = 'latexmk',
|
||||
markdown = 'pandoc',
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ in
|
|||
emmet-language-server
|
||||
lua-language-server
|
||||
mdx-language-server
|
||||
pandoc
|
||||
pytest-language-server
|
||||
ruff
|
||||
tinymist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue