panache 2.41.0

An LSP, formatter, and linter for Markdown, Quarto, and R Markdown
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
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
---
title: Configuration
description: >
  This guide describes how to configure Panache, both globally and on a
  per-project basis, and how to use configuration files to customize the
  formatting and linting rules.
---

Panache's configuration system is built around a TOML configuration file, which
allows you to customize a range of options, including formatting preferences,
linting rules, external linter and formatter integrations.

Panache searches for a configuration file in the following order:

1. **Explicit path**: `--config <path>` (errors if invalid)
2. **Project config**: `.panache.toml` or `panache.toml` in current or parent
   directories
3. **User config**: `~/$XDG_CONFIG_HOME/panache/config.toml` (typically
   `~/.config/panache/config.toml`)

## Basic Options

Here, we list the top-level configuration options that control general behavior.

### Flavor

Choose the Markdown flavor, which determines default [extension](#extensions)
settings:

```toml
flavor = "pandoc"
```

The available flavors are:

`pandoc`
:   Standard [Pandoc Markdown](https://pandoc.org) (default)

`quarto`
:   [Quarto](https://quarto.org)-flavored Markdown (Pandoc + Quarto extensions)

`rmarkdown`
:   R Markdown (Pandoc + R-specific extensions, including Bookdown): R Markdown
    (Pandoc + R-specific extensions)

`gfm`
:   GitHub-Flavored Markdown

`commonmark`
:   CommonMark (Note that we are currently **not** fully CommonMark-compliant,
    and use this option only as a means to setup the correct set of extensions):
    CommonMark (minimal extensions)

`multimarkdown`
:   MultiMarkdown flavor defaults (Pandoc-compatible MultiMarkdown extension
    set)

### Line Width

Set the maximum line width for text wrapping:

```toml
line-width = 80
```

### Flavor Overrides

Use `flavor-overrides` to pick flavor by path pattern for Markdown-family files
(`.md`, `.markdown`, `.mdown`, `.mkd`):

```toml
flavor = "quarto"

[flavor-overrides]
"README.md" = "gfm"
"docs/**/*.md" = "quarto"
```

Panache applies flavor in this order:

1. `.qmd` files always use `quarto`
2. `.Rmd` files always use `rmarkdown`
3. Markdown-family files use the most specific matching `flavor-overrides`
   pattern
4. Otherwise, Panache falls back to top-level `flavor`

### File Selection (Directory Traversal)

When you run commands on directories (`panache format .`, `panache lint .`,
`panache debug format .`), Panache supports include/exclude selectors:

```toml
exclude = [".git/", "build/"]
extend-exclude = ["tests/testthat/_snaps/"]
include = ["*.qmd", "*.md"]
extend-include = ["*.Rmd"]
```

`exclude`
:   Base exclude patterns. If set, replaces Panache's default exclude base. The
    default exclude base includes common build/cache directories and
    `**/LICENSE.md`.

`extend-exclude`
:   Additional exclude patterns appended to the base set.

`include`
:   Base include patterns. If set, replaces Panache's default include base.

`extend-include`
:   Additional include patterns appended to the base set.

Path matching base:

- For discovered config files, include/exclude globs are resolved relative to
  the directory containing the active config file.
- For explicit `--config path/to/panache.toml`, include/exclude globs are
  resolved relative to the current working directory.
- CLI path arguments (for example `panache format docs/`) limit traversal scope
  but do not change how include/exclude globs are resolved.

If a path matches both include and exclude, exclude wins.

### Pandoc Compatibility

Use `pandoc-compat` for ambiguous syntax cases where Pandoc behavior changed
across releases.

```toml
pandoc-compat = "3.7"
```

`pandoc-compat`

:   Compatibility target for ambiguous Pandoc behavior.

    - `3.9` (default): match Pandoc 3.9 behavior.
    - `3.7`: match Pandoc 3.7 behavior.
    - `latest`: alias for Panache's pinned newest verified target (currently
      `3.9`).

This option is intentionally narrow in scope and only affects cases where Pandoc
changed behavior across versions. It is global, so parser, formatter, and LSP
all use the same target behavior.

### CLI Cache

Panache can persist CLI lint/format cache entries between runs to speed up
workspace re-runs when files and config are unchanged.

```toml
cache-dir = "/absolute/path/to/cache-dir"
```

`cache-dir`
:   Optional cache directory override. Relative paths are resolved from the CLI
    start directory. If unset, Panache uses an OS-specific global cache location
    (for example `~/.cache/panache/` on Linux).

Cache validity currently includes file content, effective config, and Panache
version. When any of these change, Panache recomputes and refreshes entries. Use
`--cache-dir <CACHE_DIR>` (or `PANACHE_CACHE_DIR`) to override `cache-dir` for
one invocation. Use `--no-cache` (or `PANACHE_NO_CACHE`) to bypass cache
reads/writes for a single CLI invocation. Use `panache clean` to remove the
current workspace bucket, or `panache clean --all` to clear all global Panache
cache buckets.

## Formatting Style

Formatting style preferences are organized under the `[format]` section:

```toml
[format]
wrap = "reflow"
blank-lines = "collapse"
math-delimiter-style = "preserve"
math-indent = 0
tab-stops = "normalize"
tab-width = 4
```

### Wrapping Mode

Control how text is wrapped:

```toml
[format]
wrap = "reflow"
```

`reflow`
:   Reformat paragraphs to fit within line width (default)

`sentence`
:   Wrap after each sentence.

`preserve`
:   Keep existing line breaks

### Blank Lines

Control blank line handling:

```toml
[format]
blank-lines = "collapse"
```

`collapse`
:   Collapse multiple blank lines into one (default)

`preserve`
:   Keep all existing blank lines

### Math Formatting

Configure how math delimiters are formatted:

```toml
[format]
math-delimiter-style = "preserve"
math-indent = 0
```

Math delimiter styles:

`preserve`
:   Keep original delimiter style (default)

`dollars`
:   Normalize to `$...$` and `$$...$$`

`backslash`
:   Normalize to `\(...\)` and `\[...\]`

The `math-indent` field specifies indentation (in spaces) for display math
blocks. Default is 0.

### Tab Stops

Control how tabs are handled during formatting:

```toml
[format]
tab-stops = "normalize"
tab-width = 4
```

`normalize`
:   Convert tabs to spaces using `tab-width` (default 4).

`preserve`
:   Preserve tabs in literal code spans and fenced/indented code blocks. Tabs in
    regular text are always normalized to spaces.

`tab-width`
:   Number of spaces per tab when normalizing (default 4).

## Extensions

Panache supports most of the Pandoc extensions. Defaults vary by flavor, but you
can override any extension:

```toml
flavor = "quarto"

[extensions]
hard-line-breaks = false
citations = true
task-lists = true
```

You can also scope extension overrides to a specific flavor:

```toml
[extensions]
citations = true
task-lists = false

[extensions.gfm]
task-lists = true
```

Precedence for the active flavor is:

1. flavor defaults
2. global `[extensions]`
3. `[extensions.<flavor>]`

### Block-Level Extensions

#### Headings

```toml
[extensions]
auto-identifiers = true
gfm-auto-identifiers = false
blank-before-header = true
header-attributes = true
implicit-header-references = true
```

`auto-identifiers`
:   Auto-generate heading identifiers (default: enabled for `pandoc`, `quarto`,
    `rmarkdown`, `gfm`, and `multimarkdown`)

`gfm-auto-identifiers`
:   Use GitHub's heading identifier algorithm (default: disabled, enabled for
    `gfm` flavor)

`blank-before-header`
:   Require blank line before headers (default: enabled)

`header-attributes`
:   Full attribute syntax on headers `{#id .class key=value}` (default: enabled)

`implicit-header-references`
:   Allow `[Heading]` links to reference headers (default: enabled)

`mmd-header-identifiers`
:   MultiMarkdown heading identifiers in square brackets, e.g.
    `# Heading [myid]` and setext `Heading [myid]` (default: disabled, enabled
    for `multimarkdown` flavor)

#### Block Quotes

```toml
[extensions]
blank-before-blockquote = true
```

`blank-before-blockquote`
:   Require blank line before blockquotes (default: enabled)

#### Lists

```toml
[extensions]
fancy-lists = true
startnum = true
example-lists = true
task-lists = true
definition-lists = true
```

`fancy-lists`
:   Roman numerals, letters, and fancy list markers (default: enabled)

`startnum`
:   Start ordered lists at arbitrary numbers (default: enabled)

`example-lists`
:   Example lists with `(@)` markers (default: enabled)

`task-lists`
:   GitHub-style task lists `- [ ]` and `- [x]` (default: enabled)

`definition-lists`
:   Term/definition syntax (default: enabled)

#### Code Blocks

```toml
[extensions]
backtick-code-blocks = true
fenced-code-blocks = true
fenced-code-attributes = true
executable-code = true
inline-code-attributes = true
```

`backtick-code-blocks`
:   Fenced code blocks with \`\`\` fences (default: enabled)

`fenced-code-blocks`
:   Fenced code blocks with `~~~` fences (default: enabled)

`fenced-code-attributes`
:   Attributes on fenced code blocks `{.language #id}` (default: enabled)

`executable-code`
:   Executable code chunks with brace info strings like ```` ```{r} ```` and
    ```` ```{python} ```` (default: disabled, enabled for Quarto and RMarkdown
    flavors).

`rmarkdown-inline-code`
:   Parse inline executable code that uses R Markdown style tails like
    `` `3 == `r 2 + 1 `` \`\` (default: disabled, enabled for Quarto and
    RMarkdown flavors).

`quarto-inline-code`
:   Parse inline executable code that uses braced tails like
    `` `3 == `{r} 2 + 1 ``
    \``(default: disabled, enabled for Quarto flavor).     Formatted output is normalized to the braced`{r}\`
    marker for renderer parity in this syntax family.

`inline-code-attributes`
:   Attributes on inline code `` `code`{.class} `` (default: enabled)

#### Tables

```toml
[extensions]
simple-tables = true
multiline-tables = true
grid-tables = true
pipe-tables = true
table-captions = true
```

`simple-tables`
:   Simple table syntax (default: enabled)

`multiline-tables`
:   Multiline cells (default: enabled)

`grid-tables`
:   Grid-style tables (default: enabled)

`pipe-tables`
:   GitHub-style `|` tables (default: enabled)

`table-captions`
:   Table captions (default: enabled)

#### Divs

```toml
[extensions]
fenced-divs = true
native-divs = true
```

`fenced-divs`
:   Fenced divs `::: {.class}` (default: enabled)

`native-divs`
:   HTML `<div>` elements (default: enabled)

#### Other Blocks

```toml
[extensions]
line-blocks = true
```

`line-blocks`
:   Line blocks for poetry with `|` prefix (default: enabled)

### Inline Extensions

#### Emphasis

```toml
[extensions]
intraword-underscores = true
strikeout = true
superscript = true
subscript = true
```

`intraword-underscores`
:   Don't trigger emphasis in `snake_case` (default: enabled)

`strikeout`
:   Strikethrough `~~text~~` (default: enabled)

`superscript`
:   Superscript `^super^` (default: enabled)

`subscript`
:   Subscript `~sub~` (default: enabled)

#### Links

```toml
[extensions]
inline-links = true
reference-links = true
shortcut-reference-links = true
link-attributes = true
autolinks = true
```

`inline-links`
:   Inline links `[text](url)` (default: enabled)

`reference-links`
:   Reference links `[text][ref]` (default: enabled)

`shortcut-reference-links`
:   Shortcut reference links `[ref]` (default: enabled)

`link-attributes`
:   Attributes on links `[text](url){.class}` (default: enabled)

`mmd-link-attributes`
:   MultiMarkdown key-value attributes on reference link/image definitions,
    including indented continuation lines (default: disabled, enabled for
    `multimarkdown` flavor)

`autolinks`
:   Automatic links `<http://example.com>` (default: enabled)

`autolink-bare-uris`
:   Bare URLs become links (default: disabled, non-default extension)

#### Images

```toml
[extensions]
inline-images = true
implicit-figures = true
```

`inline-images`
:   Inline images `![alt](url)` (default: enabled)

`implicit-figures`
:   Single image becomes figure (default: enabled)

#### Math

```toml
[extensions]
tex-math-dollars = true
tex-math-gfm = false
tex-math-single-backslash = false
tex-math-double-backslash = false
```

`tex-math-dollars`
:   Dollar-delimited math `$x$` and `$$equation$$` (default: enabled)

`tex-math-gfm`
:   GFM math: inline `$`...`$` and fenced ```` ``` math ```` blocks (default:
    disabled, enabled for GFM flavor)

`tex-math-single-backslash`
:   Single backslash math `\(...\)` and `\[...\]` (default: disabled, enabled
    for RMarkdown)

`tex-math-double-backslash`
:   Double backslash math `\\(...\\)` and `\\[...\\]` (default: disabled)

#### Footnotes

```toml
[extensions]
inline-footnotes = true
footnotes = true
```

`inline-footnotes`
:   Inline footnotes `^[text]` (default: enabled)

`footnotes`
:   Reference footnotes `[^1]` and `[^1]: content` (default: enabled)

#### Citations

```toml
[extensions]
citations = true
```

`citations`
:   Citation syntax `[@cite]` (default: enabled)

#### Spans

```toml
[extensions]
bracketed-spans = true
native-spans = true
```

`bracketed-spans`
:   Bracketed spans `[text]{.class}` (default: enabled)

`native-spans`
:   HTML `<span>` elements (default: enabled)

### Metadata Extensions

```toml
[extensions]
yaml-metadata-block = true
pandoc-title-block = true
```

`yaml-metadata-block`
:   YAML frontmatter with `---` delimiters (default: enabled)

`pandoc-title-block`
:   Pandoc title block `% Title`, `% Author`, `% Date` (default: enabled)

`mmd-title-block`
:   MultiMarkdown metadata/title block at document start using `Key: Value`
    pairs with optional indented continuation lines (default: disabled, enabled
    for `multimarkdown` flavor)

### Raw Content Extensions

```toml
[extensions]
raw-html = true
markdown-in-html-blocks = false
raw-tex = true
raw-attribute = true
```

`raw-html`
:   HTML blocks and inline HTML (default: enabled)

`markdown-in-html-blocks`
:   Markdown inside HTML blocks (default: disabled)

`raw-tex`
:   LaTeX commands and environments (default: enabled)

`raw-attribute`
:   Generic raw blocks with `{=format}` syntax (default: enabled)

### Special Character Extensions

```toml
[extensions]
all-symbols-escapable = true
escaped-line-breaks = true
hard-line-breaks = false
smart = true
smart-quotes = false
emoji = false
mark = false
```

`all-symbols-escapable`
:   Backslash escapes any symbol (default: enabled)

`escaped-line-breaks`
:   Backslash at line end creates hard line break (default: enabled)

`hard-line-breaks`
:   Newline creates hard line break (default: disabled, non-default extension)

`smart`
:   Normalize smart/curly punctuation in formatter output (quotes/apostrophes
    and en/em dashes, plus ellipsis) to Markdown forms (`'`, `"`, `--`, `---`,
    `...`). Defaults: enabled for `pandoc`, `quarto`, `rmarkdown`; disabled for
    `gfm`, `commonmark`, `multimarkdown`.

`smart-quotes`
:   Normalize smart/curly quotes and apostrophes only (`'`, `"`). Unlike
    `smart`, this does not normalize dashes or ellipsis. Default: disabled.

`emoji`
:   Emoji syntax `:emoji:` (default: disabled, non-default extension)

`mark`
:   Highlighted text `==highlighted==` (default: disabled, non-default
    extension)

### Quarto-Specific Extensions

```toml
[extensions]
quarto-callouts = true
quarto-crossrefs = true
quarto-shortcodes = true
```

`quarto-callouts`
:   Quarto callout blocks `.callout-note`, `.callout-warning`, etc. (default:
    disabled, enabled for Quarto flavor)

`quarto-crossrefs`
:   Quarto cross-references `@fig-id`, `@tbl-id` (default: disabled, enabled for
    Quarto flavor)

`quarto-shortcodes`
:   Quarto shortcodes `{{< name args >}}` (default: disabled, enabled for Quarto
    flavor)

### Bookdown Extensions

```toml
[extensions]
bookdown-references = true
bookdown-equation-references = true
```

`bookdown-references`
:   Bookdown references `\@ref(label)` and `(\#label)` (default: disabled,
    enabled for RMarkdown flavor)

`bookdown-equation-references`
:   Bookdown equation references for labels like `(\#eq:label)` inside LaTeX
    math environments (default: disabled, enabled for RMarkdown flavor)

## External Formatters

Panache can invoke external formatters for code blocks. No external formatters
are enabled by default, so you have to opt-in for each language you want to
format.

::: {.callout-note}
### YAML

YAML is special: Panache has built-in YAML formatting for frontmatter and
hashpipe chunk options based on [Pretty
YAML](https://github.com/g-plane/pretty_yaml). External YAML formatters apply
*only* to fenced code blocks (with YAML language).
:::

### Basic Usage

To enable formatting for a language, map the language key to a formatter preset
or custom formatter name:

```toml
[formatters]
r = "air"
python = "ruff"
javascript = "prettier"
typescript = "prettier"
```

You can also specify multiple formatters for a language, which will run
sequentially:

```toml
[formatters]
python = ["isort", "black"]
```

Go to [Formatter Presets](#formatter-presets) for a list of built-in presets.

### Custom Formatters

Define custom formatter configurations with the `[formatters.NAME]` syntax:

```toml
[formatters]
python = ["isort", "black"]
javascript = "prettier"

[formatters.prettier]
cmd = "prettier"
args = ["--parser=babel", "--print-width=100"]
stdin = true

[formatters.isort]
cmd = "isort"
args = ["-"]
stdin = true
```

### Formatter Fields

The formatter definition supports the following fields:

`cmd`
:   Command to execute (required for custom formatters)

`args`
:   Command-line arguments (optional, defaults to empty list)

`stdin`
:   Use stdin/stdout mode (default: `true`) or file-based mode (`false`)

### Preset Inheritance

When a `[formatters.NAME]` section matches a built-in preset name, unspecified
fields are automatically inherited from the preset. This allows partial
overrides:

```toml
[formatters]
r = "air"

[formatters.air]
args = ["format", "--preset=tidyverse"]
```

In this example, `cmd` and `stdin` are inherited from the built-in `air` preset,
while `args` is customized.

How it works:

- If the formatter name matches a built-in preset (`air`, `black`, `ruff`,
  etc.), that preset's defaults are used as a base
- Any fields you specify (`cmd`, `args`, `stdin`) override the preset defaults
- Unspecified fields keep the preset values

#### Examples

- Override only `args` (inherits `cmd = "air"`, `stdin = false`):

  ```toml
  [formatters.air]
  args = ["format", "--custom-flag", "{}"]
  ```

- Override only `cmd` (inherits default `args` and `stdin`):

  ```toml
  [formatters.ruff]
  cmd = "ruff-custom"
  ```

- Override everything (complete replacement):

  ```toml
  [formatters.black]
  cmd = "my-black"
  args = ["--fast"]
  stdin = false
  ```

### Incremental Argument Modification

Instead of completely overriding `args`, you can append and prepend arguments to
the preset's base `args` using `append-args` and `prepend-args`[^1].

```toml
[formatters]
r = "air"

[formatters.air]
append-args = ["-i", "2"]
```

This adds `["-i", "2"]` after the preset's base args `["format", "{}"]`,
resulting in final args `["format", "{}", "-i", "2"]`.

Consider the following example:

```toml
[formatters.air]
prepend-args = ["--verbose"]
append-args = ["-i", "2", "--check"]
```

This will produce the following final args:
`["--verbose", "format", "{}", "-i", "2", "--check"]`.

[^1]: The idea of `append-args` and `prepend-args` is taken from the
    [conform.nvim](https://github.com/stevearc/conform.nvim) Neovim plugin.

### File-Based Formatters

For formatters that modify files in place:

```toml
[formatters]
r = "air-file"

[formatters.air-file]
cmd = "air"
args = ["format", "{}"]
stdin = false
```

The `{}` placeholder controls where the file path is inserted. If omitted, it's
appended at the end.

### Behavior

Language matching
:   Code block language (e.g., ```` ```python ````) is matched to formatter key
    (case-insensitive)

Parallel execution
:   A thread pool is used to run formatters in parallel across files and
    languages. For a single code block, formatters run sequentially in the order
    specified.

Sequential chains
:   Multiple formatters per language run in order

Error handling
:   Failed formatters preserve original code with a warning

Language compatibility
:   Built-in presets are checked against the configured language key (for
    example, `python = "ruff"` is valid but `python = "gofmt"` is rejected with
    a config warning). Custom formatter definitions remain unrestricted.

Preset metadata
:   Built-in presets include metadata (name, source URL, description, and
    supported languages) in Panache internals, which is used for validation now
    and can power future formatter lookup/help commands.

Timeout
:   30 seconds per formatter (not per chain)

Config files
:   Formatters respect their own config files (`.prettierrc`, `pyproject.toml`,
    etc.)

### Presets {#formatter-presets}

Here is a list of the current built-in formatter presets in Panache. **Command**
and **Arguments** are the defaults for `cmd` and `args` when you specify the
preset name in `[formatters]`.

See [Formatter Presets](../reference/formatter-presets) for a list of all the
presets available in Panache.

## External Code Linters

Panache can invoke external linters for code blocks. Linters are opt-in---you
choose which languages to lint.

### Quick Start

Enable linters for specific languages:

```toml
[linters]
r = "jarl"
python = "ruff"
sh = "shellcheck"
js = "eslint"
go = "staticcheck"
rust = "clippy"
```

Available linters:

  | Language              | Linter        | Command         | Notes                               |
  | --------------------- | ------------- | --------------- | ----------------------------------- |
  | R                     | `jarl`        | `jarl`          | R linter with JSON diagnostics      |
  | Python                | `ruff`        | `ruff`          | Python linter with JSON diagnostics |
  | Shell                 | `shellcheck`  | `shellcheck`    | Shell linter with JSON diagnostics  |
  | JavaScript/TypeScript | `eslint`      | `eslint`        | JS/TS linter with JSON diagnostics  |
  | Go                    | `staticcheck` | `staticcheck`   | Go linter with JSON diagnostics     |
  | Rust                  | `clippy`      | `clippy-driver` | Rust linter with JSON diagnostics   |

### How It Works

External linters analyze code blocks within your document:

1. **Collection** - Gathers all code blocks of the configured language
2. **Concatenation** - Combines blocks with blank-line preservation to maintain
   original line numbers
3. **Analysis** - Runs the external linter on the concatenated code
4. **Mapping** - Maps diagnostics back to exact line/column positions in your
   document

::: {.callout-note}
This approach handles **stateful code** correctly. For example, if an R variable
is defined in one code block and used in another, the linter sees both blocks
together and won't report false "undefined variable" errors.
:::

### Where Linters Run

CLI
:   `panache lint` shows external linter diagnostics

LSP
:   Diagnostics appear inline in your editor as you type

### Behavior

Language matching
:   Code block language (e.g., ```` ```{r} ````) is matched to linter key
    (case-insensitive)

Error handling
:   Missing linters are gracefully ignored with a warning

Compatibility checks
:   External linters declare supported languages. If `[linters]` maps a linter
    to an unsupported language (for example, `bash = "jarl"`), Panache skips
    that mapping and logs a warning.

Timeout
:   30 seconds per linter invocation

Line-accurate
:   Diagnostics report exact line/column locations

Auto-fixes
:   Supported for external linters that provide fix edits with mappable ranges
    (currently `jarl`, `ruff`, and `eslint`)

### Example

Enable R and Python linting while also formatting:

```toml
[linters]
r = "jarl"
python = "ruff"

[formatters]
r = "air"
python = "ruff"
```

## Example Configuration

Complete example with some common options:

```toml
flavor = "quarto"
line-width = 80

[format]
wrap = "reflow"
blank-lines = "collapse"
math-delimiter-style = "preserve"
math-indent = 0

[extensions]
hard-line-breaks = false
citations = true
task-lists = true

emoji = false

[formatters]
r = "air"
python = "ruff"
```