panache-cli 2.39.0__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: panache-cli
|
|
3
|
+
Version: 2.39.0
|
|
4
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
5
|
+
Classifier: Environment :: Console
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
9
|
+
Classifier: Operating System :: MacOS
|
|
10
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
11
|
+
Classifier: Programming Language :: Rust
|
|
12
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
13
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Summary: An LSP, formatter, and linter for Pandoc markdown, Quarto, and RMarkdown
|
|
16
|
+
Keywords: quarto,pandoc,markdown,formatter,language-server
|
|
17
|
+
Home-Page: https://panache.bz
|
|
18
|
+
Author-email: Johan Larsson <johan@jolars.co>
|
|
19
|
+
License: MIT
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
22
|
+
Project-URL: Changelog, https://github.com/jolars/panache/blob/main/CHANGELOG.md
|
|
23
|
+
Project-URL: Documentation, https://panache.bz
|
|
24
|
+
Project-URL: Homepage, https://panache.bz
|
|
25
|
+
Project-URL: Repository, https://github.com/jolars/panache
|
|
26
|
+
|
|
27
|
+
# Panache <img src='https://raw.githubusercontent.com/jolars/panache/refs/heads/main/images/logo.png' align="right" width="139" />
|
|
28
|
+
|
|
29
|
+
[](https://github.com/jolars/panache/actions/workflows/build-and-test.yml)
|
|
31
|
+
[](https://crates.io/crates/panache)
|
|
32
|
+
[](https://open-vsx.org/extension/jolars/panache)
|
|
34
|
+
[](https://marketplace.visualstudio.com/items?itemName=jolars.panache)
|
|
36
|
+
[](https://codecov.io/gh/jolars/panache)
|
|
37
|
+
|
|
38
|
+
A language server, formatter, and linter for Pandoc, Quarto, and R Markdown.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### From crates.io
|
|
43
|
+
|
|
44
|
+
If you have Rust installed, the easiest way is likely to install from
|
|
45
|
+
[crates.io](https://crates.io/crates/panache):
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
cargo install panache
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Pre-built Binaries
|
|
52
|
+
|
|
53
|
+
Alternatively, you can install pre-built binary packages from the [releases
|
|
54
|
+
page](https://github.com/jolars/panache/releases) for Linux, macOS, and Windows.
|
|
55
|
+
For Linux, packages are available for generic distributions (tarballs) as well
|
|
56
|
+
as Debian/Ubuntu (`.deb`) and Fedora/RHEL/openSUSE (`.rpm`).
|
|
57
|
+
|
|
58
|
+
If you prefer a one-liner installer that picks the right release artifact for
|
|
59
|
+
your platform, you can use the installer scripts below. These scripts are
|
|
60
|
+
fetched directly from this repository and then download the latest matching
|
|
61
|
+
Panache CLI release asset for your platform, installing to a user-local
|
|
62
|
+
directory by default. If you prefer, download and inspect the script before
|
|
63
|
+
running it.
|
|
64
|
+
|
|
65
|
+
For macOS and Linux:
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
curl --proto '=https' --tlsv1.2 -LsSf \
|
|
69
|
+
https://raw.githubusercontent.com/jolars/panache/refs/heads/main/scripts/panache-installer.sh | sh
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
For Windows PowerShell:
|
|
73
|
+
|
|
74
|
+
```powershell
|
|
75
|
+
powershell -NoProfile -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/jolars/panache/refs/heads/main/scripts/panache-installer.ps1 | iex"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Arch Linux
|
|
79
|
+
|
|
80
|
+
There are also two recipies available for Arch Linux in the AUR:
|
|
81
|
+
[panache](https://aur.archlinux.org/packages/panache/) and
|
|
82
|
+
[panache-bin](https://aur.archlinux.org/packages/panache-bin/). The first builds
|
|
83
|
+
from source for your system, the second uses precompiled binaries attatched to
|
|
84
|
+
GH releases. Install either using `yay` or your favorite AUR helper:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
yay -S panache
|
|
88
|
+
yay -S panache-bin
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### NixOS
|
|
92
|
+
|
|
93
|
+
Panache is available in NixOS via the `panache` package in `nixpkgs`. To add it
|
|
94
|
+
to your system configuration, include it in the `environment.systemPackages`:
|
|
95
|
+
|
|
96
|
+
```nix
|
|
97
|
+
{ pkgs, ... }:
|
|
98
|
+
|
|
99
|
+
{
|
|
100
|
+
environment.systemPackages = [
|
|
101
|
+
pkgs.panache
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### VS Code Extension
|
|
107
|
+
|
|
108
|
+
If you are running VS Code or an editor that supports VS Code extensions (like
|
|
109
|
+
Positron), you can install the [Panache
|
|
110
|
+
extension](https://marketplace.visualstudio.com/items?itemName=jolars.panache)
|
|
111
|
+
from the VS Code Marketplace or the [Open VSX
|
|
112
|
+
extension](https://open-vsx.org/extension/jolars/panache), which will
|
|
113
|
+
automatically also install the `panache` CLI and start the language server when
|
|
114
|
+
editing supported files.
|
|
115
|
+
|
|
116
|
+
### Development Version
|
|
117
|
+
|
|
118
|
+
To install the latest development version, you can run
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
cargo install --git https://github.com/jolars/panache.git panache
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This presumes you have a working and up-to-date Rust toolchain (stable, 2024
|
|
125
|
+
edition) installed. You also need to have `cargo` in your `PATH` if you want to
|
|
126
|
+
use the `panache` command directly after installation.
|
|
127
|
+
|
|
128
|
+
## Usage
|
|
129
|
+
|
|
130
|
+
Panache provides a single CLI interface for formatting, linting, and running the
|
|
131
|
+
LSP server.
|
|
132
|
+
|
|
133
|
+
### Formatting
|
|
134
|
+
|
|
135
|
+
To format a file in place, simply run:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
panache format document.qmd
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
You can also format from stdin by piping content into `panache format`:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cat <file> | panache format
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`panache format` supports glob patterns and recursive directory formatting:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
panache format **/*.{qmd,md}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
You can use Panache as a linter via the `--check` flag to check if files are
|
|
154
|
+
already formatted without making changes:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
panache format --check document.qmd
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### External Code Formatters
|
|
161
|
+
|
|
162
|
+
Panache supports external formatters for code blocks. For example, you can
|
|
163
|
+
configure it to run `air` on R code blocks and `ruff` on Python code blocks:
|
|
164
|
+
|
|
165
|
+
```toml
|
|
166
|
+
[formatters]
|
|
167
|
+
r = "air"
|
|
168
|
+
python = "ruff"
|
|
169
|
+
javascript = "prettier"
|
|
170
|
+
typescript = "prettier" # Reuse same formatter
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
You can setup custom formatters or modify built-in presets with additional
|
|
174
|
+
arguments:
|
|
175
|
+
|
|
176
|
+
```toml
|
|
177
|
+
[formatters]
|
|
178
|
+
python = ["isort", "black"]
|
|
179
|
+
javascript = "foobar"
|
|
180
|
+
|
|
181
|
+
[formatters.isort]
|
|
182
|
+
args = ["--profile=black"]
|
|
183
|
+
|
|
184
|
+
[formatters.myformatters]
|
|
185
|
+
cmd = "foobar"
|
|
186
|
+
args = ["--print-width=100"]
|
|
187
|
+
stdin = true
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Linting
|
|
191
|
+
|
|
192
|
+
Panache also features a linter that can report formatting issues and optionally
|
|
193
|
+
auto-fix them. To run the linter, use:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
panache lint document.qmd
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
As with `panache format`, you can use glob patterns and recursive formatting:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
panache lint **/*.{qmd,md}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### External Linters
|
|
206
|
+
|
|
207
|
+
As with formatting, Panache supports external linters for code blocks. These are
|
|
208
|
+
configured in the `[linters]` section of the configuration, but due to the
|
|
209
|
+
complexity of linting, including dealing with auto-fixing, external linters
|
|
210
|
+
cannot be customized and only support presets and at the moment only support R
|
|
211
|
+
via the `jarl` linter:
|
|
212
|
+
|
|
213
|
+
```toml
|
|
214
|
+
# Enable R linting
|
|
215
|
+
[linters]
|
|
216
|
+
r = "jarl" # R linter with JSON output
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Language Server
|
|
220
|
+
|
|
221
|
+
Panache implements the language server protocol (LSP) to provide editor features
|
|
222
|
+
like formatting, diagnostics, code actions, and more.
|
|
223
|
+
|
|
224
|
+
Most users should configure their editor to start the language server
|
|
225
|
+
automatically when editing. See [the language server
|
|
226
|
+
documentation](https://panache.bz/guide/lsp) for guides on configuring your
|
|
227
|
+
editor. For VS Code and related editors such as Positron, there is a [VS Code
|
|
228
|
+
Marketplace
|
|
229
|
+
extension](https://marketplace.visualstudio.com/items?itemName=jolars.panache)
|
|
230
|
+
and [Open VSX extension](https://open-vsx.org/extension/jolars/panache) that
|
|
231
|
+
provides an LSP client and additional features.
|
|
232
|
+
|
|
233
|
+
If you need to run the server manually (for debugging), use:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
panache lsp
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The server communicates over stdin/stdout and provides document formatting
|
|
240
|
+
capabilities. For Quarto projects, the LSP also reads `_quarto.yml`,
|
|
241
|
+
per-directory `_metadata.yml`, and `metadata-files` includes to supply
|
|
242
|
+
project-level metadata to bibliography-aware features. For Bookdown,
|
|
243
|
+
`_bookdown.yml`, `_output.yml`, and `index.Rmd` frontmatter are also considered.
|
|
244
|
+
|
|
245
|
+
The list of LSP features supported by Panache includes, among others:
|
|
246
|
+
|
|
247
|
+
- Document formatting (full document, incremental and range)
|
|
248
|
+
- Diagnostics with quick fixes
|
|
249
|
+
- Code actions for refactoring
|
|
250
|
+
- Convert between loose/compact lists
|
|
251
|
+
- Convert between inline/reference footnotes
|
|
252
|
+
- Document symbols/outline
|
|
253
|
+
- Folding ranges
|
|
254
|
+
- Go to definition for references and footnotes
|
|
255
|
+
|
|
256
|
+
## Configuration
|
|
257
|
+
|
|
258
|
+
Panache looks for a configuration in:
|
|
259
|
+
|
|
260
|
+
1. `.panache.toml` or `panache.toml` in current directory or parent directories
|
|
261
|
+
2. `$XDG_CONFIG_HOME/panache/config.toml` (usually
|
|
262
|
+
`~/.config/panache/config.toml`)
|
|
263
|
+
|
|
264
|
+
### Example
|
|
265
|
+
|
|
266
|
+
```toml
|
|
267
|
+
# Markdown flavor and line width
|
|
268
|
+
flavor = "quarto"
|
|
269
|
+
line-width = 80
|
|
270
|
+
line-ending = "auto"
|
|
271
|
+
|
|
272
|
+
# Formatting style
|
|
273
|
+
[format]
|
|
274
|
+
wrap = "reflow"
|
|
275
|
+
|
|
276
|
+
# External code formatters (opt-in)
|
|
277
|
+
[formatters]
|
|
278
|
+
python = ["isort", "black"] # Sequential formatting
|
|
279
|
+
r = "air" # Built-in preset
|
|
280
|
+
javascript = "prettier" # Reusable definitions
|
|
281
|
+
typescript = "prettier"
|
|
282
|
+
yaml = "yamlfmt" # Formats both code blocks AND frontmatter
|
|
283
|
+
|
|
284
|
+
# Customize formatters
|
|
285
|
+
[formatters.prettier]
|
|
286
|
+
prepend-args = ["--print-width=100"]
|
|
287
|
+
|
|
288
|
+
# External code linters
|
|
289
|
+
[linters]
|
|
290
|
+
r = "jarl" # Enable R linting
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
See [examples/panache.toml](./examples/panache.toml) for a complete
|
|
294
|
+
configuration reference.
|
|
295
|
+
|
|
296
|
+
## Integrations
|
|
297
|
+
|
|
298
|
+
### GitHub Actions
|
|
299
|
+
|
|
300
|
+
For CI, use the dedicated GitHub Action:
|
|
301
|
+
|
|
302
|
+
```yaml
|
|
303
|
+
- uses: jolars/panache-action@v1
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
See the [Integrations documentation](https://panache.bz/guide/integrations) for
|
|
307
|
+
configuration options.
|
|
308
|
+
|
|
309
|
+
### Pre-commit Hooks
|
|
310
|
+
|
|
311
|
+
Panache integrates with [pre-commit](https://pre-commit.com/) to automatically
|
|
312
|
+
format and lint your files before committing.
|
|
313
|
+
|
|
314
|
+
**Installation:**
|
|
315
|
+
|
|
316
|
+
First, install pre-commit if you haven't already:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
pip install pre-commit
|
|
320
|
+
# or
|
|
321
|
+
brew install pre-commit
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Then add Panache to your `.pre-commit-config.yaml`:
|
|
325
|
+
|
|
326
|
+
```yaml
|
|
327
|
+
repos:
|
|
328
|
+
- repo: https://github.com/jolars/panache
|
|
329
|
+
rev: v2.16.0 # Use the latest version
|
|
330
|
+
hooks:
|
|
331
|
+
- id: panache-format # Format files
|
|
332
|
+
- id: panache-lint # Lint and auto-fix issues
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
Install the hooks:
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
pre-commit install
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Panache will now automatically run on your staged `.qmd`, `.md`, and `.Rmd`
|
|
342
|
+
files before each commit.
|
|
343
|
+
|
|
344
|
+
See [examples/pre-commit-config.yaml](examples/pre-commit-config.yaml) for more
|
|
345
|
+
configuration options.
|
|
346
|
+
|
|
347
|
+
## Motivation
|
|
348
|
+
|
|
349
|
+
I wanted a formatter that understands Quarto and Pandoc syntax. I have tried to
|
|
350
|
+
use Prettier as well as mdformat, but both fail to handle some of the particular
|
|
351
|
+
syntax used in Quarto documents, such as fenced divs and some of the table
|
|
352
|
+
syntax.
|
|
353
|
+
|
|
354
|
+
## Design Goals and Scope
|
|
355
|
+
|
|
356
|
+
- Full LSP implementation with formatting, diagnostics, code actions, and more
|
|
357
|
+
- Standalone CLI for both formatting and linting
|
|
358
|
+
- Support for Quarto, Pandoc, and R Markdown syntax
|
|
359
|
+
- Lossless CST-based parsing
|
|
360
|
+
- Idempotent formatting
|
|
361
|
+
- Semi-opinionated defaults with configurable style options for common
|
|
362
|
+
formatting decisions
|
|
363
|
+
- Support for running external formatters and linters on code blocks, with
|
|
364
|
+
built-in presets for popular languages and tools
|
|
365
|
+
|
|
366
|
+
## Acknowledgements
|
|
367
|
+
|
|
368
|
+
The development of Panache has simplified considerably thanks to the extensive
|
|
369
|
+
documentation, well-structured code, and testing infrastructure provided by
|
|
370
|
+
Pandoc. We also owe significant debt to the rust-analyzer project, on which
|
|
371
|
+
Panche is heavily inspired.
|
|
372
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
panache_cli-2.39.0.data/scripts/panache.exe,sha256=tMATO4ZuscOBe2_tdNFhIRAX9ve1COaH-Ir-n2SLwAU,12390912
|
|
2
|
+
panache_cli-2.39.0.dist-info/METADATA,sha256=iGjpTs16tvszhSpBPxxfe4H9TDfxMznjdCEu4BMXfb0,11479
|
|
3
|
+
panache_cli-2.39.0.dist-info/WHEEL,sha256=0cg7uMdVM1SNK0ih4zFWnV0wsxqvcArlTmRGOaRhEnw,94
|
|
4
|
+
panache_cli-2.39.0.dist-info/licenses/LICENSE,sha256=RoX88MYz0Xi8-eMYKtHfYr3cnZZwzA1dE1Bbu7oWs0w,1091
|
|
5
|
+
panache_cli-2.39.0.dist-info/sboms/panache.cyclonedx.json,sha256=bOznG5MnYYZU-usDAFJnapGhdKXY_FBHzkrhGYLdORo,177056
|
|
6
|
+
panache_cli-2.39.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Johan Larsson
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|