snapper-fmt 0.8.1

Semantic line break formatter for Org, LaTeX, Markdown, and plaintext
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
<!DOCTYPE html>
<html lang="en" data-accent-color="teal" data-content_root="../">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0"><title>CLI Reference - snapper 0.1.0 documentation</title><link rel="shortcut icon" href="../_static/favicon.ico"/><link rel="index" title="Index" href="../genindex.html" /><link rel="search" title="Search" href="../search.html" /><link rel="next" title="Supported Formats" href="formats.html" /><link rel="prev" title="Pandoc Backend" href="../howto/pandoc-backend.html" />
      <link rel="canonical" href="https://snapper.turtletech.us/docs/reference/cli.html" /><script>
    function setColorMode(t){let e=document.documentElement;e.setAttribute("data-color-mode",t);let a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches,s=t;"auto"===t&&(s=a?"dark":"light"),"light"===s?(e.classList.remove("dark"),e.classList.add("light")):(e.classList.remove("light"),e.classList.add("dark"))}
    setColorMode(localStorage._theme||"auto");
  </script><link rel="stylesheet" type="text/css" href="../_static/pygments.css?v=e1a1ceaf" />
    <link rel="stylesheet" type="text/css" href="../_static/shibuya.css?v=44020203" />
    <link media="print" rel="stylesheet" type="text/css" href="../_static/print.css?v=20ff2c19" />
    <link rel="stylesheet" type="text/css" href="../_static/custom.css?v=ae410d03" />
    <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
  --sy-f-text: "Inter", var(--sy-f-sys), var(--sy-f-cjk), sans-serif;
  --sy-f-heading: "Inter", var(--sy-f-sys), var(--sy-f-cjk), sans-serif;
}
</style>
    <meta property="og:type" content="website"/>
  <meta property="og:url" content="https://snapper.turtletech.us/docs/reference/cli.html"/>
  <meta property="og:title" content="CLI Reference"/>
    <meta name="twitter:card" content="summary"/>
  
    <link rel="alternate" hreflang="is" href="/docs/is/reference/cli/" />
    <link rel="alternate" hreflang="pl" href="/docs/pl/reference/cli/" />
<!-- Umami injection -->
<script
  defer
  data-website-id="af8c1286-06aa-414b-958c-e015bed1e569"
  src="https://analytics.turtletech.us/script.js"
></script>
<script>
  window.umami = window.umami || { track: function () {} };
  document.addEventListener("click", function (e) {
    var link = e.target.closest("a");
    if (link && link.hostname !== location.hostname) {
      umami.track("Outbound Link", { url: link.href });
    }
  });
</script></head>
<body><div class="sy-head">
  <div class="sy-head-blur"></div>
  <div class="sy-head-inner sy-container mx-auto">
    <a class="sy-head-brand" href="../index.html">
      <img class="light-logo" src="../_static/snapper_logo.png" alt="snapper" height="28" loading="lazy" />
      <img class="dark-logo" src="../_static/snapper_logo.png" alt="snapper" height="28" loading="lazy" />
      <strong>snapper</strong>
    </a>
    <div class="sy-head-nav" id="head-nav">
      <nav class="sy-head-links"></nav>
      <div class="sy-head-extra flex items-center print:hidden"><form class="searchbox flex items-center" action="../search.html" method="get">
  <input type="text" name="q" placeholder="Search" />
  <kbd>/</kbd>
</form><div class="nav-languages">
  <button type="button">
    <span class="md:hidden">Translations</span>
    <iconify-icon icon="lucide:languages"></iconify-icon>
  </button>
  <div class="nav-languages-choices">
    <ul><li><a href="/docs/reference/cli/">English</a></li><li><a href="/docs/is/reference/cli/">Islenska</a></li><li><a href="/docs/pl/reference/cli/">Polski</a></li></ul>
  </div>
</div><div class="sy-head-socials">
  <a href="https://github.com/TurtleTech-ehf/snapper" aria-label="GitHub">
    <iconify-icon icon="simple-icons:github"></iconify-icon>
  </a></div></div>
    </div>
    <div class="sy-head-actions flex items-center shrink-0 print:hidden"><button class="js-theme theme-switch flex items-center"
data-aria-auto="Switch to light color mode"
data-aria-light="Switch to dark color mode"
data-aria-dark="Switch to auto color mode">
<i class="i-lucide theme-icon"></i>
</button><button class="md:hidden flex items-center js-menu" aria-label="Menu" type="button" aria-controls="head-nav" aria-expanded="false">
        <div class="hamburger">
          <span class="hamburger_1"></span>
          <span class="hamburger_2"></span>
          <span class="hamburger_3"></span>
        </div>
      </button>
    </div>
  </div>
</div>
<div class="sy-page sy-container flex mx-auto">
  <aside id="lside" class="sy-lside md:w-72 md:shrink-0 print:hidden">
    <div class="sy-lside-inner md:sticky">
      <div class="sy-scrollbar p-6">
        <div class="globaltoc" data-expand-depth="2"><p class="caption" role="heading" aria-level="3"><span class="caption-text">Tutorials</span></p>
<ul>
<li class="toctree-l1 _expand"><a class="reference internal" href="../tutorials/quickstart.html">Quickstart</a></li>
</ul>
<p class="caption" role="heading" aria-level="3"><span class="caption-text">How-to guides</span></p>
<ul>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/editor-integration.html">Editor Integration</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/ci-enforcement.html">CI Enforcement</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/git-filter.html">Git Smudge/Clean Filter</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/vale-integration.html">Vale Integration</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/neural-detection.html">Neural Sentence Detection</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/pragmas.html">Skip Regions with Pragmas</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../howto/pandoc-backend.html">Pandoc Backend</a></li>
</ul>
<p class="caption" role="heading" aria-level="3"><span class="caption-text">Reference</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">CLI Reference</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="formats.html">Supported Formats</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="abbreviations.html">Abbreviation Handling</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="config.html">Configuration</a></li>
</ul>
<p class="caption" role="heading" aria-level="3"><span class="caption-text">Development</span></p>
<ul>
<li class="toctree-l1 _expand"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../faq/index.html">FAQ</a></li>
<li class="toctree-l1 _expand"><a class="reference internal" href="../changelog.html">Changelog</a></li>
</ul>
        </div>
      </div>
    </div>
  </aside>
  <div class="lside-overlay js-menu" role="button" aria-label="Close left sidebar" aria-controls="lside" aria-expanded="false"></div>
  <aside id="rside" class="sy-rside pb-3 w-64 shrink-0 order-last">
    <button class="rside-close js-menu xl:hidden" aria-label="Close Table of Contents" type="button" aria-controls="rside" aria-expanded="false">
      <i class="i-lucide close"></i>
    </button>
    <div class="sy-scrollbar sy-rside-inner px-6 xl:top-16 xl:sticky xl:pl-0 pt-6 pb-4"><div class="localtoc"><h3>On this page</h3><ul>
<li><a class="reference internal" href="#synopsis">Synopsis</a></li>
<li><a class="reference internal" href="#options">Options</a><ul>
<li><a class="reference internal" href="#f-format-format"><code class="docutils literal notranslate"><span class="pre">-f</span></code>, <code class="docutils literal notranslate"><span class="pre">--format</span> <span class="pre">&lt;FORMAT&gt;</span></code></a></li>
<li><a class="reference internal" href="#stdin-filepath-path"><code class="docutils literal notranslate"><span class="pre">--stdin-filepath</span> <span class="pre">&lt;PATH&gt;</span></code></a></li>
<li><a class="reference internal" href="#o-output-file"><code class="docutils literal notranslate"><span class="pre">-o</span></code>, <code class="docutils literal notranslate"><span class="pre">--output</span> <span class="pre">&lt;FILE&gt;</span></code></a></li>
<li><a class="reference internal" href="#i-in-place"><code class="docutils literal notranslate"><span class="pre">-i</span></code>, <code class="docutils literal notranslate"><span class="pre">--in-place</span></code></a></li>
<li><a class="reference internal" href="#w-max-width-n"><code class="docutils literal notranslate"><span class="pre">-w</span></code>, <code class="docutils literal notranslate"><span class="pre">--max-width</span> <span class="pre">&lt;N&gt;</span></code></a></li>
<li><a class="reference internal" href="#check"><code class="docutils literal notranslate"><span class="pre">--check</span></code></a></li>
<li><a class="reference internal" href="#diff"><code class="docutils literal notranslate"><span class="pre">--diff</span></code></a></li>
<li><a class="reference internal" href="#range-start-end"><code class="docutils literal notranslate"><span class="pre">--range</span> <span class="pre">&lt;START:END&gt;</span></code></a></li>
<li><a class="reference internal" href="#output-format-text-json-sarif"><code class="docutils literal notranslate"><span class="pre">--output-format</span> <span class="pre">&lt;text|json|sarif&gt;</span></code></a></li>
<li><a class="reference internal" href="#neural"><code class="docutils literal notranslate"><span class="pre">--neural</span></code></a></li>
<li><a class="reference internal" href="#lang-code"><code class="docutils literal notranslate"><span class="pre">--lang</span> <span class="pre">&lt;CODE&gt;</span></code></a></li>
<li><a class="reference internal" href="#model-path-path"><code class="docutils literal notranslate"><span class="pre">--model-path</span> <span class="pre">&lt;PATH&gt;</span></code></a></li>
<li><a class="reference internal" href="#use-pandoc"><code class="docutils literal notranslate"><span class="pre">--use-pandoc</span></code></a></li>
<li><a class="reference internal" href="#config-path"><code class="docutils literal notranslate"><span class="pre">--config</span> <span class="pre">&lt;PATH&gt;</span></code></a></li>
<li><a class="reference internal" href="#h-help"><code class="docutils literal notranslate"><span class="pre">-h</span></code>, <code class="docutils literal notranslate"><span class="pre">--help</span></code></a></li>
<li><a class="reference internal" href="#v-version"><code class="docutils literal notranslate"><span class="pre">-V</span></code>, <code class="docutils literal notranslate"><span class="pre">--version</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#subcommands">Subcommands</a><ul>
<li><a class="reference internal" href="#snapper-init"><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">init</span></code></a></li>
<li><a class="reference internal" href="#snapper-sdiff-old-new"><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">sdiff</span> <span class="pre">&lt;OLD&gt;</span> <span class="pre">&lt;NEW&gt;</span></code></a></li>
<li><a class="reference internal" href="#snapper-git-diff-ref-file"><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">git-diff</span> <span class="pre">[REF]</span> <span class="pre">[FILE...]</span></code></a></li>
<li><a class="reference internal" href="#snapper-watch-patterns"><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">watch</span> <span class="pre">&lt;PATTERNS...&gt;</span></code></a></li>
<li><a class="reference internal" href="#snapper-lsp"><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">lsp</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#exit-codes">Exit codes</a></li>
</ul>
</div><a class="js-repo-stats repo-stats flex items-center" href="https://github.com/TurtleTech-ehf/snapper"
  data-type="github" data-user="TurtleTech-ehf" data-repo="snapper">
  <span class="w-8 flex items-center justify-around shrink-0 text-3xl">
    <iconify-icon icon="simple-icons:github"></iconify-icon>
  </span>
  <span class="flex-grow px-2 break-all">
    
    
      <span>snapper</span>
    
    <span class="flex text-sm repo-stats-count">
      <span class="flex items-center pr-3">
        <iconify-icon icon="lucide:star"></iconify-icon>
        <strong class="js-repo-stars ml-1">0</strong>
      </span>
      <span class="flex items-center">
        <iconify-icon icon="lucide:git-fork"></iconify-icon>
        <strong class="js-repo-forks ml-1">0</strong>
      </span>
    </span>
  </span>
</a><div class="edit-this-page">
  <a href="https://github.com/TurtleTech-ehf/snapper/blob/main/docs/source/reference/cli.rst">Edit this page</a>
</div><div id="ethical-ad-placement" data-ea-publisher="readthedocs"></div></div>
  </aside>
  <div class="rside-overlay js-menu" role="button" aria-label="Close Table of Contents" aria-controls="rside" aria-expanded="false"></div>
  <main class="sy-main w-full max-sm:max-w-full print:pt-6">
<div class="sy-breadcrumbs" role="navigation">
  <div class="sy-breadcrumbs-inner flex items-center">
    <div class="md:hidden mr-3">
      <button class="js-menu" aria-label="Menu" type="button" aria-controls="lside" aria-expanded="false">
        <i class="i-lucide menu"></i>
      </button>
    </div>
    <ol class="flex-1" itemscope itemtype="https://schema.org/BreadcrumbList"><li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
        <a itemprop="item" href="../index.html"><span itemprop="name">snapper</span></a>
        <span>/</span>
        <meta itemprop="position" content="1" />
      </li><li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
        <strong itemprop="name">CLI Reference</strong>
        <meta itemprop="position" content="2" />
      </li></ol>
    <div class="xl:hidden ml-1">
      <button class="js-menu" aria-label="Show table of contents" type="button" aria-controls="rside"
        aria-expanded="false">
        <i class="i-lucide outdent"></i>
      </button>
    </div>
  </div>
</div><div class="flex flex-col break-words justify-between">
      <div class="relative min-w-0 max-w-6xl px-6 pb-6 pt-8 xl:px-12">
  <div class="copy-page-wrapper relative pb-4 lg:absolute lg:top-8 lg:right-6 xl:right-12">
  <div id="copy-page-trigger">
    <button
      type="button"
      class="js-copy px-3 py-1 inline-flex items-center gap-1"
      data-url="https://snapper.turtletech.us/docs/_sources/reference/cli.rst.txt"
    >
      <i class="i-lucide" data-icon="copy"></i>
      <span>Copy page</span>
    </button>
    <button class="js-menu px-2 py-1" type="button" aria-label="More actions"
      aria-haspopup="menu" aria-expanded="false" aria-controls="copy-page-content">
      <i class="i-lucide chevron-down"></i>
    </button>
  </div>
  <div id="copy-page-content" role="menu" aria-orientation="vertical" aria-hidden="true">
    <div role="presentation">
      <div class="flex flex-col" role="group">
        <button class="js-copy" type="button" role="menuitem"
          data-url="https://snapper.turtletech.us/docs/_sources/reference/cli.rst.txt">
          <span class="iconify-icon">
            <i class="i-lucide" data-icon="copy"></i>
          </span>
          <span>Copy page</span>
        </button>
        <a role="menuitem" href="https://snapper.turtletech.us/docs/_sources/reference/cli.rst.txt" target="_blank" rel="nofollow"><iconify-icon icon="bi:code-slash"></iconify-icon>
            <span>View Source</span></a><a role="menuitem" href="https://chatgpt.com/?hints=search&q=Read%20https%3A//snapper.turtletech.us/docs/_sources/reference/cli.rst.txt%20so%20I%20can%20ask%20questions%20about%20it." target="_blank" rel="nofollow">
          <iconify-icon icon="bi:openai"></iconify-icon>
          <span>Open in ChatGPT</span>
        </a><a role="menuitem" href="https://claude.ai/new?q=Read%20https%3A//snapper.turtletech.us/docs/_sources/reference/cli.rst.txt%20so%20I%20can%20ask%20questions%20about%20it." target="_blank" rel="nofollow">
          <iconify-icon icon="bi:claude"></iconify-icon>
          <span>Open in Claude</span>
        </a></div>
    </div>
  </div>
</div><article class="yue dark-code" role="main">
          <section id="cli-reference">
<h1>CLI Reference<a class="headerlink" href="#cli-reference" title="Link to this heading">¶</a></h1>
<section id="synopsis">
<h2>Synopsis<a class="headerlink" href="#synopsis" title="Link to this heading">¶</a></h2>
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span><span data-line="1">snapper [OPTIONS] [FILE...]
</span><span data-line="2">snapper init [--dry-run]
</span><span data-line="3">snapper sdiff [--no-color] [-f FORMAT] &lt;OLD&gt; &lt;NEW&gt;
</span><span data-line="4">snapper git-diff [--no-color] [-f FORMAT] [REF] [FILE...]
</span><span data-line="5">snapper watch [-f FORMAT] &lt;PATTERNS...&gt;
</span><span data-line="6">snapper lsp
</span></pre></div>
</div>
<p>If no files are given, <code class="docutils literal notranslate"><span class="pre">snapper</span></code> reads from stdin and writes to stdout.</p>
</section>
<section id="options">
<h2>Options<a class="headerlink" href="#options" title="Link to this heading">¶</a></h2>
<section id="f-format-format">
<h3><code class="docutils literal notranslate"><span class="pre">-f</span></code>, <code class="docutils literal notranslate"><span class="pre">--format</span> <span class="pre">&lt;FORMAT&gt;</span></code><a class="headerlink" href="#f-format-format" title="Link to this heading">¶</a></h3>
<p>Input format.
One of: <code class="docutils literal notranslate"><span class="pre">org</span></code>, <code class="docutils literal notranslate"><span class="pre">latex</span></code>, <code class="docutils literal notranslate"><span class="pre">markdown</span></code>, <code class="docutils literal notranslate"><span class="pre">plaintext</span></code>.</p>
<p>Auto-detected from file extension when omitted.
Defaults to <code class="docutils literal notranslate"><span class="pre">plaintext</span></code> for stdin.</p>
</section>
<section id="stdin-filepath-path">
<h3><code class="docutils literal notranslate"><span class="pre">--stdin-filepath</span> <span class="pre">&lt;PATH&gt;</span></code><a class="headerlink" href="#stdin-filepath-path" title="Link to this heading">¶</a></h3>
<p>Assume this filename when reading stdin, for format auto-detection.
Useful for editor integrations that pipe buffer contents.</p>
<p>Example: <code class="docutils literal notranslate"><span class="pre">cat</span> <span class="pre">paper.org</span> <span class="pre">|</span> <span class="pre">snapper</span> <span class="pre">--stdin-filepath</span> <span class="pre">paper.org</span></code></p>
</section>
<section id="o-output-file">
<h3><code class="docutils literal notranslate"><span class="pre">-o</span></code>, <code class="docutils literal notranslate"><span class="pre">--output</span> <span class="pre">&lt;FILE&gt;</span></code><a class="headerlink" href="#o-output-file" title="Link to this heading">¶</a></h3>
<p>Write output to a file instead of stdout.</p>
</section>
<section id="i-in-place">
<h3><code class="docutils literal notranslate"><span class="pre">-i</span></code>, <code class="docutils literal notranslate"><span class="pre">--in-place</span></code><a class="headerlink" href="#i-in-place" title="Link to this heading">¶</a></h3>
<p>Modify input files in place.
Requires file arguments (not stdin).</p>
</section>
<section id="w-max-width-n">
<h3><code class="docutils literal notranslate"><span class="pre">-w</span></code>, <code class="docutils literal notranslate"><span class="pre">--max-width</span> <span class="pre">&lt;N&gt;</span></code><a class="headerlink" href="#w-max-width-n" title="Link to this heading">¶</a></h3>
<p>Maximum line width.
Sentences exceeding this width are wrapped at word boundaries using <code class="docutils literal notranslate"><span class="pre">textwrap</span></code>.
Default: <code class="docutils literal notranslate"><span class="pre">0</span></code> (unlimited).
Also respects <code class="docutils literal notranslate"><span class="pre">max_line_length</span></code> from <code class="docutils literal notranslate"><span class="pre">.editorconfig</span></code> if present.</p>
</section>
<section id="check">
<h3><code class="docutils literal notranslate"><span class="pre">--check</span></code><a class="headerlink" href="#check" title="Link to this heading">¶</a></h3>
<p>Check mode for CI.
Exits with code 1 if any file would change, without modifying anything.
Prints the paths of files that would be reformatted to stderr.</p>
</section>
<section id="diff">
<h3><code class="docutils literal notranslate"><span class="pre">--diff</span></code><a class="headerlink" href="#diff" title="Link to this heading">¶</a></h3>
<p>Show a unified diff of what would change, without modifying anything.
Useful for reviewing before committing.
Exits with code 1 if any file would change.</p>
</section>
<section id="range-start-end">
<h3><code class="docutils literal notranslate"><span class="pre">--range</span> <span class="pre">&lt;START:END&gt;</span></code><a class="headerlink" href="#range-start-end" title="Link to this heading">¶</a></h3>
<p>Only format lines in the given range (1-indexed, inclusive).
Lines outside the range pass through unchanged.
Useful for editor format-selection integrations.</p>
<p>Example: <code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">--range</span> <span class="pre">10:20</span> <span class="pre">paper.org</span></code></p>
</section>
<section id="output-format-text-json-sarif">
<h3><code class="docutils literal notranslate"><span class="pre">--output-format</span> <span class="pre">&lt;text|json|sarif&gt;</span></code><a class="headerlink" href="#output-format-text-json-sarif" title="Link to this heading">¶</a></h3>
<p>Output format for <code class="docutils literal notranslate"><span class="pre">--check</span></code> mode.
Default: <code class="docutils literal notranslate"><span class="pre">text</span></code> (prints filenames to stderr).</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">json</span></code> : outputs a JSON array with file paths and line counts</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">sarif</span></code> : outputs SARIF v2.1.0 for GitHub Code Scanning integration</p></li>
</ul>
</section>
<section id="neural">
<h3><code class="docutils literal notranslate"><span class="pre">--neural</span></code><a class="headerlink" href="#neural" title="Link to this heading">¶</a></h3>
<p>Use neural sentence detection via nnsplit (byte-level LSTM, tract backend).
Downloads and caches the model (~4MB) to <code class="docutils literal notranslate"><span class="pre">~/.cache/nnsplit/</span></code> on first use.
Rule-based detection remains the default (faster, better abbreviation handling).
Neural excels for non-English text.</p>
</section>
<section id="lang-code">
<h3><code class="docutils literal notranslate"><span class="pre">--lang</span> <span class="pre">&lt;CODE&gt;</span></code><a class="headerlink" href="#lang-code" title="Link to this heading">¶</a></h3>
<p>Language for neural sentence detection.
Default: <code class="docutils literal notranslate"><span class="pre">en</span></code>.
Available: <code class="docutils literal notranslate"><span class="pre">en</span></code>, <code class="docutils literal notranslate"><span class="pre">de</span></code>, <code class="docutils literal notranslate"><span class="pre">fr</span></code>, <code class="docutils literal notranslate"><span class="pre">no</span></code>, <code class="docutils literal notranslate"><span class="pre">sv</span></code>, <code class="docutils literal notranslate"><span class="pre">zh</span></code>, <code class="docutils literal notranslate"><span class="pre">tr</span></code>, <code class="docutils literal notranslate"><span class="pre">ru</span></code>, <code class="docutils literal notranslate"><span class="pre">uk</span></code>.</p>
</section>
<section id="model-path-path">
<h3><code class="docutils literal notranslate"><span class="pre">--model-path</span> <span class="pre">&lt;PATH&gt;</span></code><a class="headerlink" href="#model-path-path" title="Link to this heading">¶</a></h3>
<p>Path to a custom ONNX model file for neural detection.
Overrides <code class="docutils literal notranslate"><span class="pre">--lang</span></code>.</p>
</section>
<section id="use-pandoc">
<h3><code class="docutils literal notranslate"><span class="pre">--use-pandoc</span></code><a class="headerlink" href="#use-pandoc" title="Link to this heading">¶</a></h3>
<p>Use pandoc as the parser backend instead of built-in parsers.
Requires pandoc on PATH.
Enables support for typst, asciidoc, docx, html, and all other pandoc-supported formats.
Falls back silently if pandoc is unavailable (unless this flag is explicit).</p>
</section>
<section id="config-path">
<h3><code class="docutils literal notranslate"><span class="pre">--config</span> <span class="pre">&lt;PATH&gt;</span></code><a class="headerlink" href="#config-path" title="Link to this heading">¶</a></h3>
<p>Path to a <code class="docutils literal notranslate"><span class="pre">.snapperrc.toml</span></code> config file.
When omitted, <code class="docutils literal notranslate"><span class="pre">snapper</span></code> searches from the current directory upward.</p>
</section>
<section id="h-help">
<h3><code class="docutils literal notranslate"><span class="pre">-h</span></code>, <code class="docutils literal notranslate"><span class="pre">--help</span></code><a class="headerlink" href="#h-help" title="Link to this heading">¶</a></h3>
<p>Print help message.</p>
</section>
<section id="v-version">
<h3><code class="docutils literal notranslate"><span class="pre">-V</span></code>, <code class="docutils literal notranslate"><span class="pre">--version</span></code><a class="headerlink" href="#v-version" title="Link to this heading">¶</a></h3>
<p>Print version.</p>
</section>
</section>
<section id="subcommands">
<h2>Subcommands<a class="headerlink" href="#subcommands" title="Link to this heading">¶</a></h2>
<section id="snapper-init">
<h3><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">init</span></code><a class="headerlink" href="#snapper-init" title="Link to this heading">¶</a></h3>
<p>Initialize snapper for a project.
Detects which prose formats exist in the directory tree and generates:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">.snapperrc.toml</span></code> with sensible defaults</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">.gitattributes</span></code> entries for the git smudge/clean filter</p></li>
<li><p>pre-commit hook snippet</p></li>
<li><p>Apheleia (Emacs) configuration snippet</p></li>
</ul>
<p>Use <code class="docutils literal notranslate"><span class="pre">--dry-run</span></code> to preview without writing files.</p>
</section>
<section id="snapper-sdiff-old-new">
<h3><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">sdiff</span> <span class="pre">&lt;OLD&gt;</span> <span class="pre">&lt;NEW&gt;</span></code><a class="headerlink" href="#snapper-sdiff-old-new" title="Link to this heading">¶</a></h3>
<p>Sentence-level diff between two files.
Parses both files, extracts sentences, diffs at sentence granularity.
Whitespace reflow produces zero diff.
Colored output by default; use <code class="docutils literal notranslate"><span class="pre">--no-color</span></code> to disable.
Exits with code 1 if differences found.</p>
</section>
<section id="snapper-git-diff-ref-file">
<h3><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">git-diff</span> <span class="pre">[REF]</span> <span class="pre">[FILE...]</span></code><a class="headerlink" href="#snapper-git-diff-ref-file" title="Link to this heading">¶</a></h3>
<p>Sentence-level diff against a git ref.
Default ref: <code class="docutils literal notranslate"><span class="pre">HEAD</span></code>.
If no files specified, diffs all changed prose files (<code class="docutils literal notranslate"><span class="pre">.org</span></code>, <code class="docutils literal notranslate"><span class="pre">.tex</span></code>, <code class="docutils literal notranslate"><span class="pre">.md</span></code>).
Uses <code class="docutils literal notranslate"><span class="pre">git</span> <span class="pre">show</span> <span class="pre">REF:path</span></code> to retrieve the old version.</p>
</section>
<section id="snapper-watch-patterns">
<h3><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">watch</span> <span class="pre">&lt;PATTERNS...&gt;</span></code><a class="headerlink" href="#snapper-watch-patterns" title="Link to this heading">¶</a></h3>
<p>Watch files and auto-reformat on save.
Accepts file paths or glob patterns. 200ms debounce to avoid reformatting during rapid saves.
Press Ctrl+C to stop.</p>
</section>
<section id="snapper-lsp">
<h3><code class="docutils literal notranslate"><span class="pre">snapper</span> <span class="pre">lsp</span></code><a class="headerlink" href="#snapper-lsp" title="Link to this heading">¶</a></h3>
<p>Start the Language Server Protocol server on stdin/stdout.
Provides document formatting, range formatting, and diagnostics (flags lines with multiple sentences).
Works with any LSP-compatible editor (Neovim, Emacs eglot, VS Code, Helix).</p>
</section>
</section>
<section id="exit-codes">
<h2>Exit codes<a class="headerlink" href="#exit-codes" title="Link to this heading">¶</a></h2>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">0</span></code> : Success (or <code class="docutils literal notranslate"><span class="pre">--check</span></code> / <code class="docutils literal notranslate"><span class="pre">--diff</span></code> with no changes needed)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">1</span></code> : <code class="docutils literal notranslate"><span class="pre">--check</span></code> or <code class="docutils literal notranslate"><span class="pre">--diff</span></code> found files that would change, or any error</p></li>
</ul>
</section>
</section>

        </article><button class="back-to-top" type="button">
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
    <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
  </svg>
  <span>Back to top</span>
</button><div class="navigation flex print:hidden"><div class="navigation-prev">
    <a href="../howto/pandoc-backend.html">
      <i class="i-lucide chevron-left"></i>
      <div class="page-info">
        <span>Previous</span><div class="title">Pandoc Backend</div></div>
    </a>
  </div><div class="navigation-next">
    <a href="formats.html">
      <div class="page-info">
        <span>Next</span>
        <div class="title">Supported Formats</div>
      </div>
      <i class="i-lucide chevron-right"></i>
    </a>
  </div></div></div>
    </div>
  </main>
</div>
<footer class="sy-foot">
  <div class="sy-foot-inner sy-container mx-auto">
    
    <div
      style="
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
        color: var(--sy-c-text-weak);
        font-size: 0.9em;
      "
    >
      <div
        style="
          display: flex;
          flex-wrap: wrap;
          justify-content: center;
          gap: 1rem;
          align-items: center;
        "
      >

        
        <span style="display: inline-flex; align-items: center; gap: 0.3em">
          <svg
            xmlns="http://www.w3.org/2000/svg"
            width="1em"
            height="1em"
            viewBox="0 0 24 24"
            fill="currentColor"
            aria-hidden="true"
          >
            <path d="M7,20H4V4h3V20z M14,20h-3V12h3V20z M21,20h-3V8h3V20z" />
          </svg>
          <span
            >Analytics by
            <a
              href="https://umami.is/"
              target="_blank"
              rel="noopener noreferrer"
              style="color: inherit; text-decoration: underline"
              >Umami</a
            ></span
          >
        </span>

        
        <span style="display: inline-flex; align-items: center; gap: 0.3em">
          <span>provided by</span>
          <span style="display: inline-flex; align-items: center; gap: 0.3em">
            <svg xmlns="http://www.w3.org/2000/svg" width="1.4em" height="1.4em" viewBox="0 0 64 64" aria-hidden="true"><g fill-rule="evenodd"><ellipse cx="32" cy="11" fill="#80D25B" rx="7" ry="9"/><path fill="#80D25B" d="M20.3,46c0,0-3.2,9.9.3,13.8c3.5,3.9 6.1,3.4 6.1-6C26.8,44.3 20.3,46 20.3,46Z"/><path fill="#80D25B" d="M38.3,46c0,0-3.2,9.9.4,13.8c3.5,3.9 6.1,3.4 6.1-6C44.8,44.3 38.3,46 38.3,46Z" transform="matrix(-1 0 0 1 81.8 0)"/><path fill="#80D25B" d="M20.6,21.2c0,0-6.7-5.8-10.5-5.2C6.2,16.7 6,22.2 6,24c0,1.8 1.8,13.3 3.8,12.5c2-0.8 4-8.5 4-8.5c1.9,2.3 4.8,2.5 4.8,2.5L20.6,21.2Z"/><path fill="#80D25B" d="M57.6,21.2c0,0-6.6-5.8-10.5-5.2C43.2,16.7 43,22.2 43,24c0,1.8 1.8,13.3 3.8,12.5c2-0.8 4-8.5 4-8.5c1.9,2.3 4.8,2.5 4.8,2.5L57.6,21.2Z" transform="matrix(-1 0 0 1 100.623 0)"/><path fill="#BD7575" stroke="#595959" stroke-linecap="round" stroke-width="2" d="M32,53C40.8,53 48,44.5 48,34C48,23.5 46.7,17 32,17C17.3,17 16,23.5 16,34C16,44.5 23.2,53 32,53Z"/><polygon fill="#BD7575" stroke="#595959" stroke-linecap="round" stroke-width="2" points="32 22 38.9 26 38.9 34 32 38 25.1 34 25.1 26"/><path stroke="#595959" stroke-linecap="round" stroke-width="2" d="M30,8C28.9,8 28,8.9 28,10"/><path stroke="#595959" stroke-linecap="round" stroke-width="2" d="M36,8C34.9,8 34,8.9 34,10" transform="matrix(-1 0 0 1 70 0)"/><path stroke="#595959" stroke-linecap="round" stroke-width="2" d="M32.1,38.2L32.1,52.4M32,21.7L32,17M25.2,26L17.7,23.1M25.1,34.2L16.8,38.9"/><path stroke="#595959" stroke-linecap="round" stroke-width="2" d="M46.2,26L38.7,23.1" transform="matrix(-1 0 0 1 84.951 0)"/><path stroke="#595959" stroke-linecap="round" stroke-width="2" d="M47.1,34.2L38.8,38.9" transform="matrix(-1 0 0 1 85.891 0)"/></g></svg>
            <a
              href="https://turtletech.us/"
              target="_blank"
              rel="noopener noreferrer"
              style="color: inherit; text-decoration: underline"
              >TurtleTech ehf</a
            >
          </span>
        </span>
      </div>
    </div>

    
    <div class="sy-foot-reserved md:flex justify-between items-center">
      <div class="sy-foot-copyright"><p>2026--present, <a href="https://rgoswami.me">Rohit Goswami</a></p>
  
  <p>
    Made with
    
    <a href="https://www.sphinx-doc.org/">Sphinx</a> and
    
    <a href="https://shibuya.lepture.com">Shibuya theme</a>.
  </p>
</div> <div class="sy-foot-socials">
<a href="https://github.com/TurtleTech-ehf/snapper" aria-label="GitHub">
  <iconify-icon icon="simple-icons:github"></iconify-icon>
</a></div>
    </div>
  </div>
</footer>
      <script src="../_static/documentation_options.js?v=01f34227"></script>
      <script src="../_static/doctools.js?v=fd6eb6e6"></script>
      <script src="../_static/sphinx_highlight.js?v=6ffebe34"></script>
      <script src="../_static/shibuya.js?v=cac61aee"></script></body>
</html>