Compare commits
No commits in common. "22ffea117c72ca110036a9910da7796c1e28a599" and "28dda6515efb0cf33dbb833d0c3a0be05c4a20e3" have entirely different histories.
22ffea117c
...
28dda6515e
4 changed files with 22 additions and 46 deletions
|
|
@ -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, PlantUML, Mermaid, and Quarto
|
GitHub-flavored Markdown, AsciiDoc, 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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, PlantUML, Mermaid, Quarto) and supports fully custom providers.
|
AsciiDoc, Quarto) and supports fully custom providers.
|
||||||
See |preview-presets|.
|
See |preview-presets|.
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
@ -180,8 +180,6 @@ 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)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
|
||||||
24
flake.nix
24
flake.nix
|
|
@ -19,10 +19,9 @@
|
||||||
{
|
{
|
||||||
formatter = forEachSystem (pkgs: pkgs.nixfmt-tree);
|
formatter = forEachSystem (pkgs: pkgs.nixfmt-tree);
|
||||||
|
|
||||||
devShells = forEachSystem (
|
devShells = forEachSystem (pkgs: {
|
||||||
pkgs:
|
default = pkgs.mkShell {
|
||||||
let
|
packages = [
|
||||||
devTools = [
|
|
||||||
(pkgs.luajit.withPackages (
|
(pkgs.luajit.withPackages (
|
||||||
ps: with ps; [
|
ps: with ps; [
|
||||||
busted
|
busted
|
||||||
|
|
@ -33,25 +32,10 @@
|
||||||
pkgs.stylua
|
pkgs.stylua
|
||||||
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.plantuml
|
||||||
pkgs.mermaid-cli
|
pkgs.mermaid-cli
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
});
|
||||||
);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,24 +115,6 @@ local function parse_asciidoctor(output)
|
||||||
return diagnostics
|
return diagnostics
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param output string
|
|
||||||
---@return preview.Diagnostic[]
|
|
||||||
local function parse_mermaid(output)
|
|
||||||
local lnum = output:match('Parse error on line (%d+)')
|
|
||||||
if not lnum then
|
|
||||||
return {}
|
|
||||||
end
|
|
||||||
local msg = output:match('(Expecting .+)') or 'parse error'
|
|
||||||
return {
|
|
||||||
{
|
|
||||||
lnum = tonumber(lnum) - 1,
|
|
||||||
col = 0,
|
|
||||||
message = msg,
|
|
||||||
severity = vim.diagnostic.severity.ERROR,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
---@type preview.ProviderConfig
|
---@type preview.ProviderConfig
|
||||||
M.typst = {
|
M.typst = {
|
||||||
ft = 'typst',
|
ft = 'typst',
|
||||||
|
|
@ -331,7 +313,19 @@ M.mermaid = {
|
||||||
return (ctx.file:gsub('%.mmd$', '.svg'))
|
return (ctx.file:gsub('%.mmd$', '.svg'))
|
||||||
end,
|
end,
|
||||||
error_parser = function(output)
|
error_parser = function(output)
|
||||||
return parse_mermaid(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,
|
end,
|
||||||
clean = function(ctx)
|
clean = function(ctx)
|
||||||
return { 'rm', '-f', (ctx.file:gsub('%.mmd$', '.svg')) }
|
return { 'rm', '-f', (ctx.file:gsub('%.mmd$', '.svg')) }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue