No description
* fix(presets): add `--mathml` to `markdown` and `github` pandoc args Problem: pandoc's default HTML math renderer cannot handle most TeX and dumps raw LaTeX source into the output. `--mathjax` and `--katex` are incompatible with `--embed-resources` because pandoc cannot inline dynamically-loaded JavaScript modules and fonts. Solution: add `--mathml` to both `markdown` and `github` preset args. MathML is rendered natively by all modern browsers with no external dependencies, making it the only math option compatible with self-contained HTML output. * docs(presets): add math rendering section with KaTeX recipe Problem: the `markdown` and `github` presets now default to `--mathml` but users may want KaTeX or MathJax rendering instead, and the incompatibility with `--embed-resources` is non-obvious. Solution: add a `preview-math` section to the presets docs explaining the default, why `--katex`/`--mathjax` require dropping `--embed-resources`, and a concrete recipe for KaTeX with `github`. * test(presets): update `markdown` and `github` args assertions for `--mathml` * doc: cleanup * chore: remove debug files |
||
|---|---|---|
| .github/workflows | ||
| doc | ||
| lua/preview | ||
| plugin | ||
| scripts | ||
| spec | ||
| .busted | ||
| .editorconfig | ||
| .gitignore | ||
| .luarc.json | ||
| .prettierrc | ||
| .styluaignore | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| preview.nvim-scm-1.rockspec | ||
| README.md | ||
| selene.toml | ||
| stylua.toml | ||
| vim.yaml | ||
preview.nvim
Universal previewer for Neovim
An extensible framework for compiling and previewing any documents (LaTeX, Typst, Markdown, etc.)—diagnostics included.
Features
- Async compilation via
vim.system() - Built-in presets for Typst, LaTeX (latexmk, pdflatex, tectonic), Markdown, GitHub-flavored Markdown, AsciiDoc, PlantUML, Mermaid, and Quarto
- Compiler errors via
vim.diagnosticor quickfix - Previewer auto-close on buffer deletion
Requirements
- Neovim 0.11+
Installation
With lazy.nvim:
{
'barrettruth/preview.nvim',
init = function()
vim.g.preview = { typst = true, latex = true }
end,
}
Or via luarocks:
luarocks install preview.nvim
Documentation
:help preview.nvim
FAQ
Q: How do I define a custom provider?
vim.g.preview = {
rst = {
cmd = { 'rst2html' },
args = function(ctx)
return { ctx.file, ctx.output }
end,
output = function(ctx)
return ctx.file:gsub('%.rst$', '.html')
end,
},
}
Q: How do I override a preset?
vim.g.preview = {
typst = { env = { TYPST_FONT_PATHS = '/usr/share/fonts' } },
}
Q: How do I automatically open the output file?
Set open = true on your provider (all built-in presets have this enabled) to
open the output with vim.ui.open() after the first successful compilation in
toggle/watch mode. For a specific application, pass a command table:
vim.g.preview = {
typst = { open = { 'sioyek', '--new-instance' } },
}
Q: How do I set up SyncTeX (forward/inverse search)?
See :help preview-synctex for full recipes covering Zathura, Sioyek, and
Okular.