Compare commits
14 commits
fix/viewer
...
build/nix-
| Author | SHA1 | Date | |
|---|---|---|---|
| e76ace674f | |||
|
|
9fe68dd159 | ||
| 6f090fdcf3 | |||
|
|
31dcf9c91f | ||
|
|
23aa8acc55 | ||
|
|
837c97cd09 | ||
|
|
7895b67c21 | ||
|
|
f1aed82f42 | ||
|
|
bb9ca987e1 | ||
| 8107f8c0ac | |||
|
|
cf8fd02e6d | ||
|
|
3e6ba580e4 | ||
|
|
c8e3a88434 | ||
|
|
239f8a4769 |
9 changed files with 462 additions and 1263 deletions
963
README.html
963
README.html
|
|
@ -1,963 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang xml:lang>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="generator" content="pandoc" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
|
||||
<title>README</title>
|
||||
<style>
|
||||
code{white-space: pre-wrap;}
|
||||
span.smallcaps{font-variant: small-caps;}
|
||||
div.columns{display: flex; gap: min(4vw, 1.5em);}
|
||||
div.column{flex: auto; overflow-x: auto;}
|
||||
div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
|
||||
|
||||
ul.task-list[class]{list-style: none;}
|
||||
ul.task-list li input[type="checkbox"] {
|
||||
font-size: inherit;
|
||||
width: 0.8em;
|
||||
margin: 0 0.8em 0.2em -1.6em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.display.math{display: block; text-align: center; margin: 0.5rem auto;}
|
||||
|
||||
html { -webkit-text-size-adjust: 100%; }
|
||||
pre > code.sourceCode { white-space: pre; position: relative; }
|
||||
pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
|
||||
pre > code.sourceCode > span:empty { height: 1.2em; }
|
||||
.sourceCode { overflow: visible; }
|
||||
code.sourceCode > span { color: inherit; text-decoration: inherit; }
|
||||
div.sourceCode { margin: 1em 0; }
|
||||
pre.sourceCode { margin: 0; }
|
||||
@media screen {
|
||||
div.sourceCode { overflow: auto; }
|
||||
}
|
||||
@media print {
|
||||
pre > code.sourceCode { white-space: pre-wrap; }
|
||||
pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
|
||||
}
|
||||
pre.numberSource code
|
||||
{ counter-reset: source-line 0; }
|
||||
pre.numberSource code > span
|
||||
{ position: relative; left: -4em; counter-increment: source-line; }
|
||||
pre.numberSource code > span > a:first-child::before
|
||||
{ content: counter(source-line);
|
||||
position: relative; left: -1em; text-align: right; vertical-align: baseline;
|
||||
border: none; display: inline-block;
|
||||
-webkit-touch-callout: none; -webkit-user-select: none;
|
||||
-khtml-user-select: none; -moz-user-select: none;
|
||||
-ms-user-select: none; user-select: none;
|
||||
padding: 0 4px; width: 4em;
|
||||
color: #aaaaaa;
|
||||
}
|
||||
pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
|
||||
div.sourceCode
|
||||
{ }
|
||||
@media screen {
|
||||
pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
|
||||
}
|
||||
code span.al { color: #ff0000; font-weight: bold; }
|
||||
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||||
code span.at { color: #7d9029; }
|
||||
code span.bn { color: #40a070; }
|
||||
code span.bu { color: #008000; }
|
||||
code span.cf { color: #007020; font-weight: bold; }
|
||||
code span.ch { color: #4070a0; }
|
||||
code span.cn { color: #880000; }
|
||||
code span.co { color: #60a0b0; font-style: italic; }
|
||||
code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||||
code span.do { color: #ba2121; font-style: italic; }
|
||||
code span.dt { color: #902000; }
|
||||
code span.dv { color: #40a070; }
|
||||
code span.er { color: #ff0000; font-weight: bold; }
|
||||
code span.ex { }
|
||||
code span.fl { color: #40a070; }
|
||||
code span.fu { color: #06287e; }
|
||||
code span.im { color: #008000; font-weight: bold; }
|
||||
code span.in { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||||
code span.kw { color: #007020; font-weight: bold; }
|
||||
code span.op { color: #666666; }
|
||||
code span.ot { color: #007020; }
|
||||
code span.pp { color: #bc7a00; }
|
||||
code span.sc { color: #4070a0; }
|
||||
code span.ss { color: #bb6688; }
|
||||
code span.st { color: #4070a0; }
|
||||
code span.va { color: #19177c; }
|
||||
code span.vs { color: #4070a0; }
|
||||
code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; }
|
||||
</style>
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
font-family: Helvetica, arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
background-color: white;
|
||||
padding: 30px;
|
||||
color: #333;
|
||||
}
|
||||
body > *:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
body > *:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.octicon {
|
||||
display: inline-block;
|
||||
fill: currentColor;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
.anchor {
|
||||
float: left;
|
||||
line-height: 1;
|
||||
margin-left: -20px;
|
||||
padding-right: 4px;
|
||||
}
|
||||
.anchor:focus {
|
||||
outline: none;
|
||||
}
|
||||
h1 .octicon-link,
|
||||
h2 .octicon-link,
|
||||
h3 .octicon-link,
|
||||
h4 .octicon-link,
|
||||
h5 .octicon-link,
|
||||
h6 .octicon-link {
|
||||
color: #1b1f23;
|
||||
vertical-align: middle;
|
||||
visibility: hidden;
|
||||
}
|
||||
h1:hover .anchor,
|
||||
h2:hover .anchor,
|
||||
h3:hover .anchor,
|
||||
h4:hover .anchor,
|
||||
h5:hover .anchor,
|
||||
h6:hover .anchor {
|
||||
text-decoration: none;
|
||||
}
|
||||
h1:hover .anchor .octicon-link,
|
||||
h2:hover .anchor .octicon-link,
|
||||
h3:hover .anchor .octicon-link,
|
||||
h4:hover .anchor .octicon-link,
|
||||
h5:hover .anchor .octicon-link,
|
||||
h6:hover .anchor .octicon-link {
|
||||
visibility: visible;
|
||||
}
|
||||
h1:hover .anchor .octicon-link:before,
|
||||
h2:hover .anchor .octicon-link:before,
|
||||
h3:hover .anchor .octicon-link:before,
|
||||
h4:hover .anchor .octicon-link:before,
|
||||
h5:hover .anchor .octicon-link:before,
|
||||
h6:hover .anchor .octicon-link:before {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
content: ' ';
|
||||
display: inline-block;
|
||||
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' version='1.1' width='16' height='16' aria-hidden='true'%3E%3Cpath fill-rule='evenodd' d='M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z'%3E%3C/path%3E%3C/svg%3E");
|
||||
}{
|
||||
-ms-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
line-height: 1.5;
|
||||
color: #24292e;
|
||||
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
|
||||
font-size: 16px;
|
||||
line-height: 1.5;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
details {
|
||||
display: block;
|
||||
}
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
a {
|
||||
background-color: initial;
|
||||
}
|
||||
a:active,
|
||||
a:hover {
|
||||
outline-width: 0;
|
||||
}
|
||||
strong {
|
||||
font-weight: inherit;
|
||||
font-weight: bolder;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: .67em 0;
|
||||
}
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
code,
|
||||
kbd,
|
||||
pre {
|
||||
font-family: monospace,monospace;
|
||||
font-size: 1em;
|
||||
}
|
||||
hr {
|
||||
box-sizing: initial;
|
||||
height: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
input {
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
}
|
||||
input {
|
||||
overflow: visible;
|
||||
}
|
||||
[type=checkbox] {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
input {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
line-height: inherit;
|
||||
}
|
||||
a {
|
||||
color: #0366d6;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
strong {
|
||||
font-weight: 600;
|
||||
}
|
||||
hr {
|
||||
height: 0;
|
||||
margin: 15px 0;
|
||||
overflow: hidden;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-bottom: 1px solid #dfe2e5;
|
||||
}
|
||||
hr:after,
|
||||
hr:before {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
hr:after {
|
||||
clear: both;
|
||||
}
|
||||
table {
|
||||
border-spacing: 0;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
td,
|
||||
th {
|
||||
padding: 0;
|
||||
}
|
||||
details summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
kbd {
|
||||
display: inline-block;
|
||||
padding: 3px 5px;
|
||||
font: 11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
line-height: 10px;
|
||||
color: #444d56;
|
||||
vertical-align: middle;
|
||||
background-color: #fafbfc;
|
||||
border: 1px solid #d1d5da;
|
||||
border-radius: 3px;
|
||||
box-shadow: inset 0 -1px 0 #d1d5da;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 32px;
|
||||
}
|
||||
h1,
|
||||
h2 {
|
||||
font-weight: 600;
|
||||
}
|
||||
h2 {
|
||||
font-size: 24px;
|
||||
}
|
||||
h3 {
|
||||
font-size: 20px;
|
||||
}
|
||||
h3,
|
||||
h4 {
|
||||
font-weight: 600;
|
||||
}
|
||||
h4 {
|
||||
font-size: 16px;
|
||||
}
|
||||
h5 {
|
||||
font-size: 14px;
|
||||
}
|
||||
h5,
|
||||
h6 {
|
||||
font-weight: 600;
|
||||
}
|
||||
h6 {
|
||||
font-size: 12px;
|
||||
}
|
||||
p {
|
||||
margin-top: 0;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
blockquote {
|
||||
margin: 0;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
padding-left: 0;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
ol ol,
|
||||
ul ol {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
ol ol ol,
|
||||
ol ul ol,
|
||||
ul ol ol,
|
||||
ul ul ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
dd {
|
||||
margin-left: 0;
|
||||
}
|
||||
code,
|
||||
pre {
|
||||
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
pre {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
input::-webkit-inner-spin-button,
|
||||
input::-webkit-outer-spin-button {
|
||||
margin: 0;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
:checked+.radio-label {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
border-color: #0366d6;
|
||||
}
|
||||
.border {
|
||||
border: 1px solid #e1e4e8!important;
|
||||
}
|
||||
.border-0 {
|
||||
border: 0!important;
|
||||
}
|
||||
.border-bottom {
|
||||
border-bottom: 1px solid #e1e4e8!important;
|
||||
}
|
||||
.rounded-1 {
|
||||
border-radius: 3px!important;
|
||||
}
|
||||
.bg-white {
|
||||
background-color: #fff!important;
|
||||
}
|
||||
.bg-gray-light {
|
||||
background-color: #fafbfc!important;
|
||||
}
|
||||
.text-gray-light {
|
||||
color: #6a737d!important;
|
||||
}
|
||||
.mb-0 {
|
||||
margin-bottom: 0!important;
|
||||
}
|
||||
.my-2 {
|
||||
margin-top: 8px!important;
|
||||
margin-bottom: 8px!important;
|
||||
}
|
||||
.pl-0 {
|
||||
padding-left: 0!important;
|
||||
}
|
||||
.py-0 {
|
||||
padding-top: 0!important;
|
||||
padding-bottom: 0!important;
|
||||
}
|
||||
.pl-1 {
|
||||
padding-left: 4px!important;
|
||||
}
|
||||
.pl-2 {
|
||||
padding-left: 8px!important;
|
||||
}
|
||||
.py-2 {
|
||||
padding-top: 8px!important;
|
||||
padding-bottom: 8px!important;
|
||||
}
|
||||
.pl-3,
|
||||
.px-3 {
|
||||
padding-left: 16px!important;
|
||||
}
|
||||
.px-3 {
|
||||
padding-right: 16px!important;
|
||||
}
|
||||
.pl-4 {
|
||||
padding-left: 24px!important;
|
||||
}
|
||||
.pl-5 {
|
||||
padding-left: 32px!important;
|
||||
}
|
||||
.pl-6 {
|
||||
padding-left: 40px!important;
|
||||
}
|
||||
.f6 {
|
||||
font-size: 12px!important;
|
||||
}
|
||||
.lh-condensed {
|
||||
line-height: 1.25!important;
|
||||
}
|
||||
.text-bold {
|
||||
font-weight: 600!important;
|
||||
}
|
||||
.pl-c {
|
||||
color: #6a737d;
|
||||
}
|
||||
.pl-c1,
|
||||
.pl-s .pl-v {
|
||||
color: #005cc5;
|
||||
}
|
||||
.pl-e,
|
||||
.pl-en {
|
||||
color: #6f42c1;
|
||||
}
|
||||
.pl-s .pl-s1,
|
||||
.pl-smi {
|
||||
color: #24292e;
|
||||
}
|
||||
.pl-ent {
|
||||
color: #22863a;
|
||||
}
|
||||
.pl-k {
|
||||
color: #d73a49;
|
||||
}
|
||||
.pl-pds,
|
||||
.pl-s,
|
||||
.pl-s .pl-pse .pl-s1,
|
||||
.pl-sr,
|
||||
.pl-sr .pl-cce,
|
||||
.pl-sr .pl-sra,
|
||||
.pl-sr .pl-sre {
|
||||
color: #032f62;
|
||||
}
|
||||
.pl-smw,
|
||||
.pl-v {
|
||||
color: #e36209;
|
||||
}
|
||||
.pl-bu {
|
||||
color: #b31d28;
|
||||
}
|
||||
.pl-ii {
|
||||
color: #fafbfc;
|
||||
background-color: #b31d28;
|
||||
}
|
||||
.pl-c2 {
|
||||
color: #fafbfc;
|
||||
background-color: #d73a49;
|
||||
}
|
||||
.pl-c2:before {
|
||||
content: "^M";
|
||||
}
|
||||
.pl-sr .pl-cce {
|
||||
font-weight: 700;
|
||||
color: #22863a;
|
||||
}
|
||||
.pl-ml {
|
||||
color: #735c0f;
|
||||
}
|
||||
.pl-mh,
|
||||
.pl-mh .pl-en,
|
||||
.pl-ms {
|
||||
font-weight: 700;
|
||||
color: #005cc5;
|
||||
}
|
||||
.pl-mi {
|
||||
font-style: italic;
|
||||
color: #24292e;
|
||||
}
|
||||
.pl-mb {
|
||||
font-weight: 700;
|
||||
color: #24292e;
|
||||
}
|
||||
.pl-md {
|
||||
color: #b31d28;
|
||||
background-color: #ffeef0;
|
||||
}
|
||||
.pl-mi1 {
|
||||
color: #22863a;
|
||||
background-color: #f0fff4;
|
||||
}
|
||||
.pl-mc {
|
||||
color: #e36209;
|
||||
background-color: #ffebda;
|
||||
}
|
||||
.pl-mi2 {
|
||||
color: #f6f8fa;
|
||||
background-color: #005cc5;
|
||||
}
|
||||
.pl-mdr {
|
||||
font-weight: 700;
|
||||
color: #6f42c1;
|
||||
}
|
||||
.pl-ba {
|
||||
color: #586069;
|
||||
}
|
||||
.pl-sg {
|
||||
color: #959da5;
|
||||
}
|
||||
.pl-corl {
|
||||
text-decoration: underline;
|
||||
color: #032f62;
|
||||
}
|
||||
.mb-0 {
|
||||
margin-bottom: 0!important;
|
||||
}
|
||||
.my-2 {
|
||||
margin-bottom: 8px!important;
|
||||
}
|
||||
.my-2 {
|
||||
margin-top: 8px!important;
|
||||
}
|
||||
.pl-0 {
|
||||
padding-left: 0!important;
|
||||
}
|
||||
.py-0 {
|
||||
padding-top: 0!important;
|
||||
padding-bottom: 0!important;
|
||||
}
|
||||
.pl-1 {
|
||||
padding-left: 4px!important;
|
||||
}
|
||||
.pl-2 {
|
||||
padding-left: 8px!important;
|
||||
}
|
||||
.py-2 {
|
||||
padding-top: 8px!important;
|
||||
padding-bottom: 8px!important;
|
||||
}
|
||||
.pl-3 {
|
||||
padding-left: 16px!important;
|
||||
}
|
||||
.pl-4 {
|
||||
padding-left: 24px!important;
|
||||
}
|
||||
.pl-5 {
|
||||
padding-left: 32px!important;
|
||||
}
|
||||
.pl-6 {
|
||||
padding-left: 40px!important;
|
||||
}
|
||||
.pl-7 {
|
||||
padding-left: 48px!important;
|
||||
}
|
||||
.pl-8 {
|
||||
padding-left: 64px!important;
|
||||
}
|
||||
.pl-9 {
|
||||
padding-left: 80px!important;
|
||||
}
|
||||
.pl-10 {
|
||||
padding-left: 96px!important;
|
||||
}
|
||||
.pl-11 {
|
||||
padding-left: 112px!important;
|
||||
}
|
||||
.pl-12 {
|
||||
padding-left: 128px!important;
|
||||
}
|
||||
hr {
|
||||
border-bottom-color: #eee;
|
||||
}
|
||||
kbd {
|
||||
display: inline-block;
|
||||
padding: 3px 5px;
|
||||
font: 11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
line-height: 10px;
|
||||
color: #444d56;
|
||||
vertical-align: middle;
|
||||
background-color: #fafbfc;
|
||||
border: 1px solid #d1d5da;
|
||||
border-radius: 3px;
|
||||
box-shadow: inset 0 -1px 0 #d1d5da;
|
||||
}
|
||||
.markdown-body:after,
|
||||
.markdown-body:before {
|
||||
display: table;
|
||||
content: "";
|
||||
}
|
||||
.markdown-body:after {
|
||||
clear: both;
|
||||
}
|
||||
.markdown-body>:first-child {
|
||||
margin-top: 0!important;
|
||||
}
|
||||
.markdown-body>:last-child {
|
||||
margin-bottom: 0!important;
|
||||
}
|
||||
a:not([href]) {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
blockquote,
|
||||
details,
|
||||
dl,
|
||||
ol,
|
||||
p,
|
||||
pre,
|
||||
table,
|
||||
ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
hr {
|
||||
height: .25em;
|
||||
padding: 0;
|
||||
margin: 24px 0;
|
||||
background-color: #e1e4e8;
|
||||
border: 0;
|
||||
}
|
||||
blockquote {
|
||||
padding: 0 1em;
|
||||
color: #6a737d;
|
||||
border-left: .25em solid #dfe2e5;
|
||||
}
|
||||
blockquote>:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
blockquote>:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
margin-top: 24px;
|
||||
margin-bottom: 16px;
|
||||
font-weight: 600;
|
||||
line-height: 1.25;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
}
|
||||
h1,
|
||||
h2 {
|
||||
padding-bottom: .3em;
|
||||
border-bottom: 1px solid #eaecef;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
h3 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
h4 {
|
||||
font-size: 1em;
|
||||
}
|
||||
h5 {
|
||||
font-size: .875em;
|
||||
}
|
||||
h6 {
|
||||
font-size: .85em;
|
||||
color: #6a737d;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
padding-left: 2em;
|
||||
}
|
||||
ol ol,
|
||||
ol ul,
|
||||
ul ol,
|
||||
ul ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
li {
|
||||
word-wrap: break-all;
|
||||
}
|
||||
li>p {
|
||||
margin-top: 16px;
|
||||
}
|
||||
li+li {
|
||||
margin-top: .25em;
|
||||
}
|
||||
dl {
|
||||
padding: 0;
|
||||
}
|
||||
dl dt {
|
||||
padding: 0;
|
||||
margin-top: 16px;
|
||||
font-size: 1em;
|
||||
font-style: italic;
|
||||
font-weight: 600;
|
||||
}
|
||||
dl dd {
|
||||
padding: 0 16px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
table {
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
table th {
|
||||
font-weight: 600;
|
||||
}
|
||||
table td,
|
||||
table th {
|
||||
padding: 6px 13px;
|
||||
border: 1px solid #dfe2e5;
|
||||
}
|
||||
table tr {
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #c6cbd1;
|
||||
}
|
||||
table tr:nth-child(2n) {
|
||||
background-color: #f6f8fa;
|
||||
}
|
||||
img {
|
||||
max-width: 100%;
|
||||
box-sizing: initial;
|
||||
background-color: #fff;
|
||||
}
|
||||
img[align=right] {
|
||||
padding-left: 20px;
|
||||
}
|
||||
img[align=left] {
|
||||
padding-right: 20px;
|
||||
}
|
||||
code {
|
||||
padding: .2em .4em;
|
||||
margin: 0;
|
||||
font-size: 85%;
|
||||
background-color: rgba(27,31,35,.05);
|
||||
border-radius: 3px;
|
||||
}
|
||||
pre {
|
||||
word-wrap: normal;
|
||||
}
|
||||
pre>code {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-size: 100%;
|
||||
word-break: normal;
|
||||
white-space: pre;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
}
|
||||
.highlight {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.highlight pre {
|
||||
margin-bottom: 0;
|
||||
word-break: normal;
|
||||
}
|
||||
.highlight pre,
|
||||
pre {
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
font-size: 85%;
|
||||
line-height: 1.45;
|
||||
background-color: #f6f8fa;
|
||||
border-radius: 3px;
|
||||
}
|
||||
pre code {
|
||||
display: inline;
|
||||
max-width: auto;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: visible;
|
||||
line-height: inherit;
|
||||
word-wrap: normal;
|
||||
background-color: initial;
|
||||
border: 0;
|
||||
}
|
||||
.commit-tease-sha {
|
||||
display: inline-block;
|
||||
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
font-size: 90%;
|
||||
color: #444d56;
|
||||
}
|
||||
.full-commit .btn-outline:not(:disabled):hover {
|
||||
color: #005cc5;
|
||||
border-color: #005cc5;
|
||||
}
|
||||
.blob-wrapper {
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
.blob-wrapper-embedded {
|
||||
max-height: 240px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.blob-num {
|
||||
width: 1%;
|
||||
min-width: 50px;
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
font-size: 12px;
|
||||
line-height: 20px;
|
||||
color: rgba(27,31,35,.3);
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
vertical-align: top;
|
||||
cursor: pointer;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
.blob-num:hover {
|
||||
color: rgba(27,31,35,.6);
|
||||
}
|
||||
.blob-num:before {
|
||||
content: attr(data-line-number);
|
||||
}
|
||||
.blob-code {
|
||||
position: relative;
|
||||
padding-right: 10px;
|
||||
padding-left: 10px;
|
||||
line-height: 20px;
|
||||
vertical-align: top;
|
||||
}
|
||||
.blob-code-inner {
|
||||
overflow: visible;
|
||||
font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
font-size: 12px;
|
||||
color: #24292e;
|
||||
word-wrap: normal;
|
||||
white-space: pre;
|
||||
}
|
||||
.pl-token.active,
|
||||
.pl-token:hover {
|
||||
cursor: pointer;
|
||||
background: #ffea7f;
|
||||
}
|
||||
.tab-size[data-tab-size="1"] {
|
||||
-moz-tab-size: 1;
|
||||
tab-size: 1;
|
||||
}
|
||||
.tab-size[data-tab-size="2"] {
|
||||
-moz-tab-size: 2;
|
||||
tab-size: 2;
|
||||
}
|
||||
.tab-size[data-tab-size="3"] {
|
||||
-moz-tab-size: 3;
|
||||
tab-size: 3;
|
||||
}
|
||||
.tab-size[data-tab-size="4"] {
|
||||
-moz-tab-size: 4;
|
||||
tab-size: 4;
|
||||
}
|
||||
.tab-size[data-tab-size="5"] {
|
||||
-moz-tab-size: 5;
|
||||
tab-size: 5;
|
||||
}
|
||||
.tab-size[data-tab-size="6"] {
|
||||
-moz-tab-size: 6;
|
||||
tab-size: 6;
|
||||
}
|
||||
.tab-size[data-tab-size="7"] {
|
||||
-moz-tab-size: 7;
|
||||
tab-size: 7;
|
||||
}
|
||||
.tab-size[data-tab-size="8"] {
|
||||
-moz-tab-size: 8;
|
||||
tab-size: 8;
|
||||
}
|
||||
.tab-size[data-tab-size="9"] {
|
||||
-moz-tab-size: 9;
|
||||
tab-size: 9;
|
||||
}
|
||||
.tab-size[data-tab-size="10"] {
|
||||
-moz-tab-size: 10;
|
||||
tab-size: 10;
|
||||
}
|
||||
.tab-size[data-tab-size="11"] {
|
||||
-moz-tab-size: 11;
|
||||
tab-size: 11;
|
||||
}
|
||||
.tab-size[data-tab-size="12"] {
|
||||
-moz-tab-size: 12;
|
||||
tab-size: 12;
|
||||
}
|
||||
.task-list-item {
|
||||
list-style-type: none;
|
||||
}
|
||||
.task-list-item+.task-list-item {
|
||||
margin-top: 3px;
|
||||
}
|
||||
.task-list-item input {
|
||||
margin: 0 .2em .25em -1.6em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="previewnvim">preview.nvim</h1>
|
||||
<p><strong>Universal document previewer for Neovim</strong></p>
|
||||
<p>An extensible framework for compiling and previewing <em>any</em>
|
||||
documents (LaTeX, Typst, Markdown, etc.)—diagnostics included.</p>
|
||||
<h2 id="features">Features</h2>
|
||||
<ul>
|
||||
<li>Async compilation via <code>vim.system()</code></li>
|
||||
<li>Built-in presets for Typst, LaTeX (latexmk, pdflatex, tectonic),
|
||||
Markdown, GitHub-flavored Markdown, AsciiDoc, and Quarto</li>
|
||||
<li>Compiler errors as native <code>vim.diagnostic</code></li>
|
||||
<li>User events for extensibility (<code>PreviewCompileStarted</code>,
|
||||
<code>PreviewCompileSuccess</code>,
|
||||
<code>PreviewCompileFailed</code>)</li>
|
||||
</ul>
|
||||
<h2 id="requirements">Requirements</h2>
|
||||
<ul>
|
||||
<li>Neovim 0.11+</li>
|
||||
</ul>
|
||||
<h2 id="installation">Installation</h2>
|
||||
<p>Install with your package manager of choice or via <a href="https://luarocks.org/modules/barrettruth/preview.nvim">luarocks</a>:</p>
|
||||
<pre><code>luarocks install preview.nvim</code></pre>
|
||||
<h2 id="documentation">Documentation</h2>
|
||||
<pre class="vim"><code>:help preview.nvim</code></pre>
|
||||
<h2 id="faq">FAQ</h2>
|
||||
<p><strong>Q: How do I define a custom provider?</strong></p>
|
||||
<div class="sourceCode" id="cb3"><pre class="sourceCode lua"><code class="sourceCode lua"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="fu">require</span><span class="op">(</span><span class="st">'preview'</span><span class="op">).</span>setup<span class="op">({</span></span>
|
||||
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="va">rst</span> <span class="op">=</span> <span class="op">{</span></span>
|
||||
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="va">cmd</span> <span class="op">=</span> <span class="op">{</span> <span class="st">'rst2html'</span> <span class="op">},</span></span>
|
||||
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> <span class="va">args</span> <span class="op">=</span> <span class="kw">function</span><span class="op">(</span><span class="va">ctx</span><span class="op">)</span></span>
|
||||
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="op">{</span> <span class="va">ctx</span><span class="op">.</span><span class="va">file</span><span class="op">,</span> <span class="va">ctx</span><span class="op">.</span><span class="va">output</span> <span class="op">}</span></span>
|
||||
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="kw">end</span><span class="op">,</span></span>
|
||||
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true" tabindex="-1"></a> <span class="va">output</span> <span class="op">=</span> <span class="kw">function</span><span class="op">(</span><span class="va">ctx</span><span class="op">)</span></span>
|
||||
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true" tabindex="-1"></a> <span class="cf">return</span> <span class="va">ctx</span><span class="op">.</span><span class="va">file</span><span class="op">:</span><span class="fu">gsub</span><span class="op">(</span><span class="st">'%.rst$'</span><span class="op">,</span> <span class="st">'.html'</span><span class="op">)</span></span>
|
||||
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true" tabindex="-1"></a> <span class="kw">end</span><span class="op">,</span></span>
|
||||
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true" tabindex="-1"></a> <span class="op">},</span></span>
|
||||
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true" tabindex="-1"></a><span class="op">})</span></span></code></pre></div>
|
||||
<p><strong>Q: How do I override a preset?</strong></p>
|
||||
<div class="sourceCode" id="cb4"><pre class="sourceCode lua"><code class="sourceCode lua"><span id="cb4-1"><a href="#cb4-1" aria-hidden="true" tabindex="-1"></a><span class="fu">require</span><span class="op">(</span><span class="st">'preview'</span><span class="op">).</span>setup<span class="op">({</span></span>
|
||||
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true" tabindex="-1"></a> <span class="va">typst</span> <span class="op">=</span> <span class="op">{</span> <span class="va">env</span> <span class="op">=</span> <span class="op">{</span> <span class="cn">TYPST_FONT_PATHS</span> <span class="op">=</span> <span class="st">'/usr/share/fonts'</span> <span class="op">}</span> <span class="op">},</span></span>
|
||||
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true" tabindex="-1"></a><span class="op">})</span></span></code></pre></div>
|
||||
<p><strong>Q: How do I automatically open the output file?</strong></p>
|
||||
<p>Set <code>open = true</code> on your provider (all built-in presets
|
||||
have this enabled) to open the output with <code>vim.ui.open()</code>
|
||||
after the first successful compilation in toggle/watch mode. For a
|
||||
specific application, pass a command table:</p>
|
||||
<div class="sourceCode" id="cb5"><pre class="sourceCode lua"><code class="sourceCode lua"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="fu">require</span><span class="op">(</span><span class="st">'preview'</span><span class="op">).</span>setup<span class="op">({</span></span>
|
||||
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a> <span class="va">typst</span> <span class="op">=</span> <span class="op">{</span> <span class="va">open</span> <span class="op">=</span> <span class="op">{</span> <span class="st">'sioyek'</span><span class="op">,</span> <span class="st">'--new-instance'</span> <span class="op">}</span> <span class="op">},</span></span>
|
||||
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true" tabindex="-1"></a><span class="op">})</span></span></code></pre></div>
|
||||
<script>(function(){var es=new EventSource("http://localhost:37327/__live/events");es.addEventListener("reload",function(){location.reload();});})()</script>
|
||||
</body>
|
||||
</html>
|
||||
39
README.md
39
README.md
|
|
@ -2,17 +2,18 @@
|
|||
|
||||
**Universal document previewer for Neovim**
|
||||
|
||||
An extensible framework for compiling and previewing *any* documents (LaTeX, Typst,
|
||||
Markdown, etc.)—diagnostics included.
|
||||
An extensible framework for compiling and previewing _any_ documents (LaTeX,
|
||||
Typst, Markdown, etc.)—diagnostics included.
|
||||
|
||||
<video src="https://github.com/user-attachments/assets/3b4fbc31-c1c4-4429-a9dc-a68d6185ab2e" width="100%" controls></video>
|
||||
|
||||
## Features
|
||||
|
||||
- Async compilation via `vim.system()`
|
||||
- Built-in presets for Typst, LaTeX (latexmk, pdflatex, tectonic), Markdown,
|
||||
GitHub-flavored Markdown, AsciiDoc, and Quarto
|
||||
- Compiler errors as native `vim.diagnostic`
|
||||
- User events for extensibility (`PreviewCompileStarted`,
|
||||
`PreviewCompileSuccess`, `PreviewCompileFailed`)
|
||||
GitHub-flavored Markdown, AsciiDoc, PlantUML, Mermaid, and Quarto
|
||||
- Compiler errors via `vim.diagnostic` or quickfix
|
||||
- Previewer auto-close on buffer deletion
|
||||
|
||||
## Requirements
|
||||
|
||||
|
|
@ -20,8 +21,18 @@ Markdown, etc.)—diagnostics included.
|
|||
|
||||
## Installation
|
||||
|
||||
Install with your package manager of choice or via
|
||||
[luarocks](https://luarocks.org/modules/barrettruth/preview.nvim):
|
||||
With lazy.nvim:
|
||||
|
||||
```lua
|
||||
{
|
||||
'barrettruth/preview.nvim',
|
||||
init = function()
|
||||
vim.g.preview = { typst = true, latex = true }
|
||||
end,
|
||||
}
|
||||
```
|
||||
|
||||
Or via [luarocks](https://luarocks.org/modules/barrettruth/preview.nvim):
|
||||
|
||||
```
|
||||
luarocks install preview.nvim
|
||||
|
|
@ -38,7 +49,7 @@ luarocks install preview.nvim
|
|||
**Q: How do I define a custom provider?**
|
||||
|
||||
```lua
|
||||
require('preview').setup({
|
||||
vim.g.preview = {
|
||||
rst = {
|
||||
cmd = { 'rst2html' },
|
||||
args = function(ctx)
|
||||
|
|
@ -48,15 +59,15 @@ require('preview').setup({
|
|||
return ctx.file:gsub('%.rst$', '.html')
|
||||
end,
|
||||
},
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
**Q: How do I override a preset?**
|
||||
|
||||
```lua
|
||||
require('preview').setup({
|
||||
vim.g.preview = {
|
||||
typst = { env = { TYPST_FONT_PATHS = '/usr/share/fonts' } },
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
**Q: How do I automatically open the output file?**
|
||||
|
|
@ -66,7 +77,7 @@ open the output with `vim.ui.open()` after the first successful compilation in
|
|||
toggle/watch mode. For a specific application, pass a command table:
|
||||
|
||||
```lua
|
||||
require('preview').setup({
|
||||
vim.g.preview = {
|
||||
typst = { open = { 'sioyek', '--new-instance' } },
|
||||
})
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -1,274 +0,0 @@
|
|||
*preview.nvim.txt* Async document compilation for Neovim
|
||||
|
||||
Author: Barrett Ruth <br.barrettruth@gmail.com>
|
||||
License: MIT
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *preview.nvim*
|
||||
|
||||
preview.nvim is an extensible framework for compiling documents asynchronously
|
||||
in Neovim. It provides a unified interface for any compilation workflow —
|
||||
LaTeX, Typst, Markdown, or anything else with a CLI compiler.
|
||||
|
||||
The plugin ships with opt-in presets for common tools (Typst, LaTeX, Pandoc,
|
||||
AsciiDoc, Quarto) and supports fully custom providers.
|
||||
See |preview.nvim-presets|.
|
||||
|
||||
==============================================================================
|
||||
REQUIREMENTS *preview.nvim-requirements*
|
||||
|
||||
- Neovim >= 0.11.0
|
||||
- A compiler binary for each configured provider (e.g. `typst`, `latexmk`)
|
||||
|
||||
==============================================================================
|
||||
SETUP *preview.nvim-setup*
|
||||
|
||||
Load preview.nvim with your package manager. For example, with lazy.nvim: >lua
|
||||
{
|
||||
'barrettruth/preview.nvim',
|
||||
}
|
||||
<
|
||||
Call |preview.setup()| to configure providers before use.
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *preview.nvim-configuration*
|
||||
|
||||
Configure via `require('preview').setup()`.
|
||||
|
||||
*preview.setup()*
|
||||
setup({opts?})
|
||||
|
||||
`opts` is a table where keys are preset names or filetypes. For each
|
||||
key `k` with value `v` (excluding `debug`):
|
||||
|
||||
- If `k` is a preset name and `v` is `true`, the preset is registered
|
||||
as-is under its filetype.
|
||||
- If `k` is a preset name and `v` is a table, it is deep-merged with
|
||||
the preset and registered under the preset's filetype.
|
||||
- If `k` is not a preset name and `v` is a table, it is registered
|
||||
directly as a custom provider keyed by filetype `k`.
|
||||
- If `v` is `false`, the entry is skipped (no-op).
|
||||
|
||||
See |preview.nvim-presets| for available preset names.
|
||||
|
||||
Fields:~
|
||||
|
||||
`debug` boolean|string Enable debug logging. A string value
|
||||
is treated as a log file path.
|
||||
Default: `false`
|
||||
|
||||
*preview.ProviderConfig*
|
||||
Provider fields:~
|
||||
|
||||
`cmd` string[] The compiler command (required).
|
||||
|
||||
`args` string[]|function Additional arguments. If a function,
|
||||
receives a |preview.Context| and returns
|
||||
a string[].
|
||||
|
||||
`cwd` string|function Working directory. If a function,
|
||||
receives a |preview.Context|. Default:
|
||||
git root or file directory.
|
||||
|
||||
`env` table Environment variables.
|
||||
|
||||
`output` string|function Output file path. If a function,
|
||||
receives a |preview.Context|.
|
||||
|
||||
`error_parser` function Receives (output, |preview.Context|)
|
||||
and returns vim.Diagnostic[].
|
||||
|
||||
`errors` false|'diagnostic'|'quickfix'
|
||||
How parse errors are reported.
|
||||
`false` suppresses error handling.
|
||||
`'quickfix'` populates the quickfix
|
||||
list and opens it. Default:
|
||||
`'diagnostic'`.
|
||||
|
||||
`clean` string[]|function Command to remove build artifacts.
|
||||
If a function, receives a
|
||||
|preview.Context|.
|
||||
|
||||
`open` boolean|string[] Open the output file after the first
|
||||
successful compilation in toggle/watch
|
||||
mode. `true` uses |vim.ui.open()|. A
|
||||
string[] is run as a command with the
|
||||
output path appended. When a string[]
|
||||
is used the viewer process is tracked
|
||||
and sent SIGTERM when the buffer is
|
||||
deleted. `true` and single-instance
|
||||
apps (e.g. Chrome) do not support
|
||||
auto-close.
|
||||
|
||||
`reload` boolean|string[]|function
|
||||
Reload the output after recompilation.
|
||||
`true` uses a built-in SSE server for
|
||||
HTML files. A string[] is run as a
|
||||
command. If a function, receives a
|
||||
|preview.Context| and returns a
|
||||
string[].
|
||||
|
||||
*preview.Context*
|
||||
Context fields:~
|
||||
|
||||
`bufnr` integer Buffer number.
|
||||
`file` string Absolute file path.
|
||||
`root` string Project root (git root or file directory).
|
||||
`ft` string Filetype.
|
||||
`output` string? Resolved output file path (set after `output`
|
||||
is evaluated, available to `args` functions).
|
||||
|
||||
Example enabling presets:~
|
||||
>lua
|
||||
require('preview').setup({ typst = true, latex = true, github = true })
|
||||
<
|
||||
|
||||
Example overriding a preset field:~
|
||||
>lua
|
||||
require('preview').setup({
|
||||
typst = { open = { 'sioyek', '--new-instance' } },
|
||||
})
|
||||
<
|
||||
|
||||
Example overriding the output path (e.g. latexmk `$out_dir`):~
|
||||
>lua
|
||||
require('preview').setup({
|
||||
latex = {
|
||||
output = function(ctx)
|
||||
return 'build/' .. vim.fn.fnamemodify(ctx.file, ':t:r') .. '.pdf'
|
||||
end,
|
||||
},
|
||||
})
|
||||
<
|
||||
|
||||
Example with a fully custom provider (key is not a preset name):~
|
||||
>lua
|
||||
require('preview').setup({
|
||||
rst = {
|
||||
cmd = { 'rst2html' },
|
||||
args = function(ctx)
|
||||
return { ctx.file }
|
||||
end,
|
||||
output = function(ctx)
|
||||
return ctx.file:gsub('%.rst$', '.html')
|
||||
end,
|
||||
},
|
||||
})
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
PRESETS *preview.nvim-presets*
|
||||
|
||||
preview.nvim ships with pre-built provider configurations for common tools.
|
||||
Import them from `preview.presets`:
|
||||
|
||||
`presets.typst` typst compile → PDF
|
||||
`presets.latex` latexmk -pdf → PDF (with clean support)
|
||||
`presets.pdflatex` pdflatex → PDF (single pass, no latexmk)
|
||||
`presets.tectonic` tectonic → PDF (Rust-based LaTeX engine)
|
||||
`presets.markdown` pandoc → HTML (standalone, embedded)
|
||||
`presets.github` pandoc → HTML (GitHub-styled, `-f gfm` input)
|
||||
`presets.asciidoctor` asciidoctor → HTML (AsciiDoc with SSE reload)
|
||||
`presets.quarto` quarto render → HTML (scientific publishing)
|
||||
|
||||
Enable presets with `preset_name = true`:
|
||||
>lua
|
||||
require('preview').setup({ typst = true, latex = true, github = true })
|
||||
<
|
||||
|
||||
Override individual fields by passing a table instead of `true`:
|
||||
>lua
|
||||
require('preview').setup({
|
||||
typst = { env = { TYPST_FONT_PATHS = '/usr/share/fonts' } },
|
||||
})
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
COMMANDS *preview.nvim-commands*
|
||||
|
||||
:Preview [subcommand] *:Preview*
|
||||
|
||||
Subcommands:~
|
||||
|
||||
`toggle` Toggle auto-compile on save (default if omitted).
|
||||
`compile` One-shot compile of the current buffer.
|
||||
`clean` Run the provider's clean command.
|
||||
`open` Open the last compiled output without recompiling.
|
||||
`status` Echo compilation status (idle, compiling, watching).
|
||||
|
||||
==============================================================================
|
||||
API *preview.nvim-api*
|
||||
|
||||
preview.toggle({bufnr?}) *preview.toggle()*
|
||||
Toggle auto-compile for the buffer. When enabled, the buffer is
|
||||
immediately compiled and automatically recompiled on each save
|
||||
(`BufWritePost`). Call again to stop.
|
||||
|
||||
preview.compile({bufnr?}) *preview.compile()*
|
||||
One-shot compile the document in the given buffer (default: current).
|
||||
|
||||
preview.stop({bufnr?}) *preview.stop()*
|
||||
Kill the active compilation process for the buffer. Programmatic
|
||||
escape hatch — not exposed as a subcommand.
|
||||
|
||||
preview.clean({bufnr?}) *preview.clean()*
|
||||
Run the provider's clean command for the buffer.
|
||||
|
||||
preview.open({bufnr?}) *preview.open()*
|
||||
Open the last compiled output for the buffer without recompiling.
|
||||
|
||||
preview.status({bufnr?}) *preview.status()*
|
||||
Returns a |preview.Status| table.
|
||||
|
||||
preview.statusline({bufnr?}) *preview.statusline()*
|
||||
Returns a short status string for statusline integration:
|
||||
`'compiling'`, `'watching'`, or `''` (idle).
|
||||
|
||||
*preview.Status*
|
||||
Status fields:~
|
||||
|
||||
`compiling` boolean Whether compilation is active.
|
||||
`watching` boolean Whether auto-compile is active.
|
||||
`provider` string? Name of the active provider.
|
||||
`output_file` string? Path to the output file.
|
||||
|
||||
preview.get_config() *preview.get_config()*
|
||||
Returns the resolved |preview.Config|.
|
||||
|
||||
==============================================================================
|
||||
EVENTS *preview.nvim-events*
|
||||
|
||||
preview.nvim fires User autocmds with structured data:
|
||||
|
||||
`PreviewCompileStarted` Compilation began.
|
||||
data: `{ bufnr, provider }`
|
||||
|
||||
`PreviewCompileSuccess` Compilation succeeded (exit code 0).
|
||||
data: `{ bufnr, provider, output }`
|
||||
|
||||
`PreviewCompileFailed` Compilation failed (non-zero exit).
|
||||
data: `{ bufnr, provider, code, stderr }`
|
||||
|
||||
Example:~
|
||||
>lua
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'PreviewCompileSuccess',
|
||||
callback = function(args)
|
||||
local data = args.data
|
||||
vim.notify('Compiled ' .. data.output .. ' with ' .. data.provider)
|
||||
end,
|
||||
})
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
HEALTH *preview.nvim-health*
|
||||
|
||||
Run `:checkhealth preview` to verify:
|
||||
|
||||
- Neovim version >= 0.11.0
|
||||
- Each configured provider's binary is executable
|
||||
- Each configured provider's opener binary (if any) is executable
|
||||
- Each configured provider's filetype mapping is valid
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
276
doc/preview.txt
Normal file
276
doc/preview.txt
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
*preview.txt* Async document compilation for Neovim
|
||||
|
||||
Author: Barrett Ruth <br.barrettruth@gmail.com>
|
||||
License: MIT
|
||||
|
||||
==============================================================================
|
||||
INTRODUCTION *preview.nvim*
|
||||
|
||||
preview.nvim is an extensible framework for compiling documents asynchronously
|
||||
in Neovim. It provides a unified interface for any compilation workflow —
|
||||
LaTeX, Typst, Markdown, or anything else with a CLI compiler.
|
||||
|
||||
The plugin ships with opt-in presets for common tools (Typst, LaTeX, Pandoc,
|
||||
AsciiDoc, PlantUML, Mermaid, Quarto) and supports fully custom providers.
|
||||
See |preview-presets|.
|
||||
|
||||
==============================================================================
|
||||
CONTENTS *preview-contents*
|
||||
|
||||
1. Introduction ............................................. |preview.nvim|
|
||||
2. Requirements ..................................... |preview-requirements|
|
||||
3. Install ............................................... |preview-install|
|
||||
4. Configuration ........................................... |preview-config|
|
||||
5. Presets ............................................... |preview-presets|
|
||||
6. Commands ............................................. |preview-commands|
|
||||
7. Lua API ................................................... |preview-api|
|
||||
8. Events ............................................... |preview-events|
|
||||
9. Health ............................................... |preview-health|
|
||||
|
||||
==============================================================================
|
||||
REQUIREMENTS *preview-requirements*
|
||||
|
||||
- Neovim >= 0.11.0
|
||||
- A compiler binary for each configured provider (e.g. `typst`, `latexmk`)
|
||||
|
||||
==============================================================================
|
||||
INSTALL *preview-install*
|
||||
|
||||
Install with lazy.nvim: >lua
|
||||
{ 'barrettruth/preview.nvim' }
|
||||
<
|
||||
|
||||
No `setup()` call is needed. The plugin loads automatically when
|
||||
|vim.g.preview| is set. See |preview-config|.
|
||||
|
||||
==============================================================================
|
||||
CONFIGURATION *preview-config*
|
||||
|
||||
Configure by setting |vim.g.preview| to a table where keys are preset names
|
||||
or filetypes. For each key `k` with value `v` (excluding `debug`):
|
||||
|
||||
- If `k` is a preset name and `v` is `true`, the preset is registered
|
||||
as-is under its filetype.
|
||||
- If `k` is a preset name and `v` is a table, it is deep-merged with
|
||||
the preset and registered under the preset's filetype.
|
||||
- If `k` is not a preset name and `v` is a table, it is registered
|
||||
directly as a custom provider keyed by filetype `k`.
|
||||
- If `v` is `false`, the entry is skipped (no-op).
|
||||
|
||||
See |preview-presets| for available preset names.
|
||||
|
||||
*preview.ProviderConfig*
|
||||
Provider fields: ~
|
||||
|
||||
{cmd} (string[]) Compiler command (required).
|
||||
|
||||
{args} (string[]|function) Additional arguments. If a function,
|
||||
receives a |preview.Context| and
|
||||
returns a string[].
|
||||
|
||||
{cwd} (string|function) Working directory. If a function,
|
||||
receives a |preview.Context|.
|
||||
Default: git root or file directory.
|
||||
|
||||
{env} (table) Environment variables.
|
||||
|
||||
{output} (string|function) Output file path. If a function,
|
||||
receives a |preview.Context|.
|
||||
|
||||
{error_parser} (function) Receives (output, |preview.Context|)
|
||||
and returns vim.Diagnostic[].
|
||||
|
||||
{errors} (false|'diagnostic'|'quickfix')
|
||||
How parse errors are reported.
|
||||
`false` suppresses error handling.
|
||||
`'quickfix'` populates the quickfix
|
||||
list and opens it.
|
||||
Default: `'diagnostic'`.
|
||||
|
||||
{clean} (string[]|function) Command to remove build artifacts.
|
||||
If a function, receives a
|
||||
|preview.Context|.
|
||||
|
||||
{open} (boolean|string[]) Open the output file after the first
|
||||
successful compilation in toggle/watch
|
||||
mode. `true` uses |vim.ui.open()|. A
|
||||
string[] is run as a command with the
|
||||
output path appended. When a string[]
|
||||
is used the viewer process is tracked
|
||||
and sent SIGTERM when the buffer is
|
||||
deleted. `true` and single-instance
|
||||
apps (e.g. Chrome) do not support
|
||||
auto-close.
|
||||
|
||||
{reload} (boolean|string[]|function)
|
||||
Reload the output after recompilation.
|
||||
`true` uses a built-in SSE server for
|
||||
HTML files. A string[] is run as a
|
||||
command. If a function, receives a
|
||||
|preview.Context| and returns a
|
||||
string[].
|
||||
|
||||
{detach} (boolean) When `true`, the viewer process opened
|
||||
via a string[] `open` command is not
|
||||
sent SIGTERM when the buffer is
|
||||
deleted. Has no effect when `open` is
|
||||
`true`. Default: `false`.
|
||||
|
||||
*preview.Context*
|
||||
Context fields: ~
|
||||
|
||||
{bufnr} (integer) Buffer number.
|
||||
{file} (string) Absolute file path.
|
||||
{root} (string) Project root (git root or file directory).
|
||||
{ft} (string) Filetype.
|
||||
{output} (string?) Resolved output file path (set after `output`
|
||||
is evaluated, available to `args` functions).
|
||||
|
||||
Global options: ~
|
||||
|
||||
{debug} (boolean|string) Enable debug logging. A string value is treated
|
||||
as a log file path. Default: `false`.
|
||||
|
||||
Example enabling presets: >lua
|
||||
vim.g.preview = { typst = true, latex = true, github = true }
|
||||
<
|
||||
|
||||
Example overriding a preset field: >lua
|
||||
vim.g.preview = {
|
||||
typst = { open = { 'sioyek', '--new-instance' } },
|
||||
}
|
||||
<
|
||||
|
||||
Example overriding the output path (e.g. latexmk `$out_dir`): >lua
|
||||
vim.g.preview = {
|
||||
latex = {
|
||||
output = function(ctx)
|
||||
return 'build/' .. vim.fn.fnamemodify(ctx.file, ':t:r') .. '.pdf'
|
||||
end,
|
||||
},
|
||||
}
|
||||
<
|
||||
|
||||
Example with a fully custom provider (key is not a preset name): >lua
|
||||
vim.g.preview = {
|
||||
rst = {
|
||||
cmd = { 'rst2html' },
|
||||
args = function(ctx)
|
||||
return { ctx.file }
|
||||
end,
|
||||
output = function(ctx)
|
||||
return ctx.file:gsub('%.rst$', '.html')
|
||||
end,
|
||||
},
|
||||
}
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
PRESETS *preview-presets*
|
||||
|
||||
Built-in provider configurations. Enable with `preset_name = true` or
|
||||
override individual fields by passing a table instead: >lua
|
||||
vim.g.preview = { typst = true, latex = true, github = true }
|
||||
<
|
||||
|
||||
`typst` typst compile → PDF
|
||||
`latex` latexmk -pdf → PDF (with clean support)
|
||||
`pdflatex` pdflatex → PDF (single pass, no latexmk)
|
||||
`tectonic` tectonic → PDF (Rust-based LaTeX engine)
|
||||
`markdown` pandoc → HTML (standalone, embedded)
|
||||
`github` pandoc → HTML (GitHub-styled, `-f gfm` input)
|
||||
`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)
|
||||
|
||||
==============================================================================
|
||||
COMMANDS *preview-commands*
|
||||
|
||||
:Preview [subcommand] *:Preview*
|
||||
|
||||
Subcommands: ~
|
||||
|
||||
`toggle` Toggle auto-compile on save (default if omitted).
|
||||
`compile` One-shot compile of the current buffer.
|
||||
`clean` Run the provider's clean command.
|
||||
`open` Open the last compiled output without recompiling.
|
||||
`status` Echo compilation status (idle, compiling, watching).
|
||||
|
||||
==============================================================================
|
||||
LUA API *preview-api*
|
||||
|
||||
preview.toggle({bufnr?}) *preview.toggle()*
|
||||
Toggle auto-compile for the buffer. When enabled, the buffer is
|
||||
immediately compiled and automatically recompiled on each save
|
||||
(`BufWritePost`). Call again to stop.
|
||||
|
||||
preview.compile({bufnr?}) *preview.compile()*
|
||||
One-shot compile the document in the given buffer (default: current).
|
||||
|
||||
preview.stop({bufnr?}) *preview.stop()*
|
||||
Kill the active compilation process for the buffer. Programmatic
|
||||
escape hatch — not exposed as a subcommand.
|
||||
|
||||
preview.clean({bufnr?}) *preview.clean()*
|
||||
Run the provider's clean command for the buffer.
|
||||
|
||||
preview.open({bufnr?}) *preview.open()*
|
||||
Open the last compiled output for the buffer without recompiling.
|
||||
|
||||
preview.status({bufnr?}) *preview.status()*
|
||||
Returns a |preview.Status| table.
|
||||
|
||||
preview.statusline({bufnr?}) *preview.statusline()*
|
||||
Returns a short status string for statusline integration:
|
||||
`'compiling'`, `'watching'`, or `''` (idle).
|
||||
|
||||
preview.get_config() *preview.get_config()*
|
||||
Returns the resolved |preview.Config|.
|
||||
|
||||
*preview.Status*
|
||||
Status fields: ~
|
||||
|
||||
{compiling} (boolean) Whether compilation is active.
|
||||
{watching} (boolean) Whether auto-compile is active.
|
||||
{provider} (string?) Name of the active provider.
|
||||
{output_file} (string?) Path to the output file.
|
||||
|
||||
==============================================================================
|
||||
EVENTS *preview-events*
|
||||
|
||||
preview.nvim fires User autocmds with structured data:
|
||||
|
||||
`PreviewCompileStarted` Compilation began.
|
||||
data: `{ bufnr, provider }`
|
||||
|
||||
`PreviewCompileSuccess` Compilation succeeded (exit code 0).
|
||||
data: `{ bufnr, provider, output }`
|
||||
|
||||
`PreviewCompileFailed` Compilation failed (non-zero exit).
|
||||
data: `{ bufnr, provider, code, stderr }`
|
||||
|
||||
Example: >lua
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'PreviewCompileSuccess',
|
||||
callback = function(args)
|
||||
local data = args.data
|
||||
vim.notify('Compiled ' .. data.output .. ' with ' .. data.provider)
|
||||
end,
|
||||
})
|
||||
<
|
||||
|
||||
==============================================================================
|
||||
HEALTH *preview-health*
|
||||
|
||||
Run |:checkhealth| preview to verify your setup: >vim
|
||||
:checkhealth preview
|
||||
<
|
||||
|
||||
Checks: ~
|
||||
- Neovim version >= 0.11.0
|
||||
- Each configured provider's binary is executable
|
||||
- Each configured provider's opener binary (if any) is executable
|
||||
|
||||
==============================================================================
|
||||
vim:tw=78:ts=8:ft=help:norl:
|
||||
26
flake.nix
26
flake.nix
|
|
@ -19,9 +19,9 @@
|
|||
{
|
||||
formatter = forEachSystem (pkgs: pkgs.nixfmt-tree);
|
||||
|
||||
devShells = forEachSystem (pkgs: {
|
||||
default = pkgs.mkShell {
|
||||
packages = [
|
||||
devShells = forEachSystem (pkgs:
|
||||
let
|
||||
devTools = [
|
||||
(pkgs.luajit.withPackages (
|
||||
ps: with ps; [
|
||||
busted
|
||||
|
|
@ -33,7 +33,23 @@
|
|||
pkgs.selene
|
||||
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
|
||||
];
|
||||
};
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,12 +143,47 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
table.concat(reload_cmd, ' ')
|
||||
)
|
||||
|
||||
local stderr_acc = {}
|
||||
local obj
|
||||
obj = vim.system(
|
||||
reload_cmd,
|
||||
{
|
||||
cwd = cwd,
|
||||
env = provider.env,
|
||||
stderr = vim.schedule_wrap(function(_err, data)
|
||||
if not data or not vim.api.nvim_buf_is_valid(bufnr) then
|
||||
return
|
||||
end
|
||||
stderr_acc[#stderr_acc + 1] = data
|
||||
local errors_mode = provider.errors
|
||||
if errors_mode == nil then
|
||||
errors_mode = 'diagnostic'
|
||||
end
|
||||
if provider.error_parser and errors_mode then
|
||||
local output = table.concat(stderr_acc)
|
||||
if errors_mode == 'diagnostic' then
|
||||
diagnostic.set(bufnr, name, provider.error_parser, output, ctx)
|
||||
elseif errors_mode == 'quickfix' then
|
||||
local ok, diags = pcall(provider.error_parser, output, ctx)
|
||||
if ok and diags and #diags > 0 then
|
||||
local items = {}
|
||||
for _, d in ipairs(diags) do
|
||||
table.insert(items, {
|
||||
bufnr = bufnr,
|
||||
lnum = d.lnum + 1,
|
||||
col = d.col + 1,
|
||||
text = d.message,
|
||||
type = d.severity == vim.diagnostic.severity.WARN and 'W' or 'E',
|
||||
})
|
||||
end
|
||||
vim.fn.setqflist(items, 'r')
|
||||
local win = vim.fn.win_getid()
|
||||
vim.cmd.cwindow()
|
||||
vim.fn.win_gotoid(win)
|
||||
end
|
||||
end
|
||||
end
|
||||
end),
|
||||
},
|
||||
vim.schedule_wrap(function(result)
|
||||
if active[bufnr] and active[bufnr].obj == obj then
|
||||
|
|
@ -182,7 +217,9 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
})
|
||||
end
|
||||
vim.fn.setqflist(items, 'r')
|
||||
vim.cmd('copen')
|
||||
local win = vim.fn.win_getid()
|
||||
vim.cmd.cwindow()
|
||||
vim.fn.win_gotoid(win)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -228,6 +265,17 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
return
|
||||
end
|
||||
stop_open_watcher(bufnr)
|
||||
stderr_acc = {}
|
||||
local errors_mode = provider.errors
|
||||
if errors_mode == nil then
|
||||
errors_mode = 'diagnostic'
|
||||
end
|
||||
if errors_mode == 'diagnostic' then
|
||||
diagnostic.clear(bufnr)
|
||||
elseif errors_mode == 'quickfix' then
|
||||
vim.fn.setqflist({}, 'r')
|
||||
vim.cmd.cwindow()
|
||||
end
|
||||
do_open(bufnr, output_file, provider.open)
|
||||
opened[bufnr] = true
|
||||
end)
|
||||
|
|
@ -243,7 +291,9 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
callback = function()
|
||||
M.stop(bufnr)
|
||||
stop_open_watcher(bufnr)
|
||||
close_viewer(bufnr)
|
||||
if not provider.detach then
|
||||
close_viewer(bufnr)
|
||||
end
|
||||
last_output[bufnr] = nil
|
||||
end,
|
||||
})
|
||||
|
|
@ -288,6 +338,7 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
diagnostic.clear(bufnr)
|
||||
elseif errors_mode == 'quickfix' then
|
||||
vim.fn.setqflist({}, 'r')
|
||||
vim.cmd.cwindow()
|
||||
end
|
||||
vim.api.nvim_exec_autocmds('User', {
|
||||
pattern = 'PreviewCompileSuccess',
|
||||
|
|
@ -329,7 +380,9 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
})
|
||||
end
|
||||
vim.fn.setqflist(items, 'r')
|
||||
vim.cmd('copen')
|
||||
local win = vim.fn.win_getid()
|
||||
vim.cmd.cwindow()
|
||||
vim.fn.win_gotoid(win)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -353,7 +406,9 @@ function M.compile(bufnr, name, provider, ctx, opts)
|
|||
once = true,
|
||||
callback = function()
|
||||
M.stop(bufnr)
|
||||
close_viewer(bufnr)
|
||||
if not provider.detach then
|
||||
close_viewer(bufnr)
|
||||
end
|
||||
last_output[bufnr] = nil
|
||||
end,
|
||||
})
|
||||
|
|
@ -456,7 +511,9 @@ function M.toggle(bufnr, name, provider, ctx_builder)
|
|||
callback = function()
|
||||
M.unwatch(bufnr)
|
||||
stop_open_watcher(bufnr)
|
||||
close_viewer(bufnr)
|
||||
if not provider.detach then
|
||||
close_viewer(bufnr)
|
||||
end
|
||||
opened[bufnr] = nil
|
||||
end,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
---@field clean? string[]|fun(ctx: preview.Context): string[]
|
||||
---@field open? boolean|string[]
|
||||
---@field reload? boolean|string[]|fun(ctx: preview.Context): string[]
|
||||
---@field detach? boolean
|
||||
|
||||
---@class preview.Config
|
||||
---@field debug boolean|string
|
||||
|
|
@ -101,6 +102,13 @@ function M.setup(opts)
|
|||
end, 'false, "diagnostic", or "quickfix"')
|
||||
vim.validate(prefix .. '.open', provider.open, { 'boolean', 'table' }, true)
|
||||
vim.validate(prefix .. '.reload', provider.reload, { 'boolean', 'table', 'function' }, true)
|
||||
vim.validate(prefix .. '.detach', provider.detach, 'boolean', true)
|
||||
end
|
||||
|
||||
if providers['plantuml'] then
|
||||
vim.filetype.add({
|
||||
extension = { puml = 'plantuml', pu = 'plantuml' },
|
||||
})
|
||||
end
|
||||
|
||||
config = vim.tbl_deep_extend('force', default_config, {
|
||||
|
|
@ -246,4 +254,8 @@ M._test = {
|
|||
end,
|
||||
}
|
||||
|
||||
if vim.g.preview then
|
||||
M.setup(vim.g.preview)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ M.typst = {
|
|||
end,
|
||||
open = true,
|
||||
reload = function(ctx)
|
||||
return { 'typst', 'watch', ctx.file }
|
||||
return { 'typst', 'watch', '--diagnostic-format', 'short', ctx.file }
|
||||
end,
|
||||
}
|
||||
|
||||
|
|
@ -271,6 +271,68 @@ M.asciidoctor = {
|
|||
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
|
||||
M.quarto = {
|
||||
ft = 'quarto',
|
||||
|
|
|
|||
|
|
@ -50,7 +50,9 @@ describe('presets', function()
|
|||
assert.is_table(result)
|
||||
assert.are.equal('typst', result[1])
|
||||
assert.are.equal('watch', result[2])
|
||||
assert.are.equal(ctx.file, result[3])
|
||||
assert.are.equal('--diagnostic-format', result[3])
|
||||
assert.are.equal('short', result[4])
|
||||
assert.are.equal(ctx.file, result[5])
|
||||
end)
|
||||
|
||||
it('parses errors from stderr', function()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue