Compare commits

..

6 commits

Author SHA1 Message Date
e76ace674f merge: resolve conflict with origin/main 2026-03-05 11:04:53 -05:00
Barrett Ruth
9fe68dd159
docs: document plantuml and mermaid presets (#47)
Problem: the README and vimdoc presets list omitted `plantuml` and
`mermaid` after both were added.

Solution: add both presets to the vimdoc table and the README features
blurb.
2026-03-05 11:03:43 -05:00
6f090fdcf3
build: split nix dev shell into default and presets
Problem: the single dev shell mixed dev tooling (linters, test runner)
with preset compiler tools, causing heavy rebuilds (e.g. Chromium for
`mermaid-cli`) for contributors who only need the dev tools.

Solution: extract dev tooling into a shared `devTools` list and expose
two shells — `default` for development and `presets` for running all
built-in preset compilers (`typst`, `texliveMedium`, `tectonic`,
`pandoc`, `asciidoctor`, `quarto`, `plantuml`, `mermaid-cli`).
2026-03-05 10:55:03 -05:00
Barrett Ruth
31dcf9c91f
feat: add mermaid preset (#46)
Problem: no built-in support for compiling mermaid diagrams via `mmdc`.

Solution: add a `mermaid` preset that compiles `.mmd` files to SVG and
parses `Parse error on line N` diagnostics from stderr. Add
`mermaid-cli` to the nix dev shell.
2026-03-05 10:44:33 -05:00
Barrett Ruth
23aa8acc55
feat: add plantuml preset (#45)
Problem: PlantUML (`.puml`) diagrams have no built-in preview support,
and Neovim lacks filetype detection for PlantUML files.

Solution: Add a `plantuml` preset that compiles to SVG via `plantuml
-tsvg`, with an error parser for `Error line N` diagnostics. Register
`.puml` and `.pu` extensions via `vim.filetype.add` when the preset is
configured. Add `plantuml` to the nix dev shell.
2026-03-05 09:32:33 -05:00
Barrett Ruth
837c97cd09
docs: rewrite vimdoc to match pending.txt conventions (#44)
Problem: The vimdoc used `preview.nvim.txt` filename and
`*preview.nvim-xyz*` tags, inconsistent with other plugins.

Solution: Rename to `preview.txt`, normalize tags to `*preview-xyz*`,
add contents/install sections, and use `{field} (type)` formatting.
2026-03-05 01:38:29 -05:00
5 changed files with 93 additions and 7 deletions

View file

@ -11,7 +11,7 @@ Typst, Markdown, etc.)—diagnostics included.
- Async compilation via `vim.system()` - Async compilation via `vim.system()`
- Built-in presets for Typst, LaTeX (latexmk, pdflatex, tectonic), Markdown, - Built-in presets for Typst, LaTeX (latexmk, pdflatex, tectonic), Markdown,
GitHub-flavored Markdown, AsciiDoc, and Quarto GitHub-flavored Markdown, AsciiDoc, PlantUML, Mermaid, and Quarto
- Compiler errors via `vim.diagnostic` or quickfix - Compiler errors via `vim.diagnostic` or quickfix
- Previewer auto-close on buffer deletion - Previewer auto-close on buffer deletion

View file

@ -11,7 +11,7 @@ in Neovim. It provides a unified interface for any compilation workflow —
LaTeX, Typst, Markdown, or anything else with a CLI compiler. LaTeX, Typst, Markdown, or anything else with a CLI compiler.
The plugin ships with opt-in presets for common tools (Typst, LaTeX, Pandoc, The plugin ships with opt-in presets for common tools (Typst, LaTeX, Pandoc,
AsciiDoc, Quarto) and supports fully custom providers. AsciiDoc, PlantUML, Mermaid, Quarto) and supports fully custom providers.
See |preview-presets|. See |preview-presets|.
============================================================================== ==============================================================================
@ -180,6 +180,8 @@ override individual fields by passing a table instead: >lua
`markdown` pandoc → HTML (standalone, embedded) `markdown` pandoc → HTML (standalone, embedded)
`github` pandoc → HTML (GitHub-styled, `-f gfm` input) `github` pandoc → HTML (GitHub-styled, `-f gfm` input)
`asciidoctor` asciidoctor → HTML (AsciiDoc with SSE reload) `asciidoctor` asciidoctor → HTML (AsciiDoc with SSE reload)
`plantuml` plantuml → SVG (UML diagrams, `.puml`)
`mermaid` mmdc → SVG (Mermaid diagrams, `.mmd`)
`quarto` quarto render → HTML (scientific publishing) `quarto` quarto render → HTML (scientific publishing)
============================================================================== ==============================================================================

View file

@ -19,9 +19,9 @@
{ {
formatter = forEachSystem (pkgs: pkgs.nixfmt-tree); formatter = forEachSystem (pkgs: pkgs.nixfmt-tree);
devShells = forEachSystem (pkgs: { devShells = forEachSystem (pkgs:
default = pkgs.mkShell { let
packages = [ devTools = [
(pkgs.luajit.withPackages ( (pkgs.luajit.withPackages (
ps: with ps; [ ps: with ps; [
busted busted
@ -33,6 +33,22 @@
pkgs.selene pkgs.selene
pkgs.lua-language-server pkgs.lua-language-server
]; ];
in
{
default = pkgs.mkShell {
packages = devTools;
};
presets = pkgs.mkShell {
packages = devTools ++ [
pkgs.typst
pkgs.texliveMedium
pkgs.tectonic
pkgs.pandoc
pkgs.asciidoctor
pkgs.quarto
pkgs.plantuml
pkgs.mermaid-cli
];
}; };
}); });
}; };

View file

@ -105,6 +105,12 @@ function M.setup(opts)
vim.validate(prefix .. '.detach', provider.detach, 'boolean', true) vim.validate(prefix .. '.detach', provider.detach, 'boolean', true)
end end
if providers['plantuml'] then
vim.filetype.add({
extension = { puml = 'plantuml', pu = 'plantuml' },
})
end
config = vim.tbl_deep_extend('force', default_config, { config = vim.tbl_deep_extend('force', default_config, {
debug = debug, debug = debug,
providers = providers, providers = providers,

View file

@ -271,6 +271,68 @@ M.asciidoctor = {
reload = true, reload = true,
} }
---@type preview.ProviderConfig
M.plantuml = {
ft = 'plantuml',
cmd = { 'plantuml' },
args = function(ctx)
return { '-tsvg', ctx.file }
end,
output = function(ctx)
return (ctx.file:gsub('%.puml$', '.svg'))
end,
error_parser = function(output)
local diagnostics = {}
for line in output:gmatch('[^\r\n]+') do
local lnum = line:match('^Error line (%d+) in file:')
if lnum then
table.insert(diagnostics, {
lnum = tonumber(lnum) - 1,
col = 0,
message = line,
severity = vim.diagnostic.severity.ERROR,
})
end
end
return diagnostics
end,
clean = function(ctx)
return { 'rm', '-f', (ctx.file:gsub('%.puml$', '.svg')) }
end,
open = true,
}
---@type preview.ProviderConfig
M.mermaid = {
ft = 'mermaid',
cmd = { 'mmdc' },
args = function(ctx)
return { '-i', ctx.file, '-o', ctx.output }
end,
output = function(ctx)
return (ctx.file:gsub('%.mmd$', '.svg'))
end,
error_parser = function(output)
local diagnostics = {}
for line in output:gmatch('[^\r\n]+') do
local lnum = line:match('^%s*Parse error on line (%d+)')
if lnum then
table.insert(diagnostics, {
lnum = tonumber(lnum) - 1,
col = 0,
message = line,
severity = vim.diagnostic.severity.ERROR,
})
end
end
return diagnostics
end,
clean = function(ctx)
return { 'rm', '-f', (ctx.file:gsub('%.mmd$', '.svg')) }
end,
open = true,
}
---@type preview.ProviderConfig ---@type preview.ProviderConfig
M.quarto = { M.quarto = {
ft = 'quarto', ft = 'quarto',