Editor Setup
Connect Panache to your editor, configure formatting on save, and enable semantic highlighting for Quarto and other Markdown flavors.
Set up Panache in your editor using the instructions below. Most integrations start panache lsp automatically when you open a supported document. RStudio uses the Panache R package’s formatting addins instead.
For formatting, diagnostics, navigation, and code actions, see Language Server.
Editor Configuration
If you want to start the language server manually (for debugging), then you can run panache lsp in your terminal. This will start the server and wait for JSON-RPC input. But most users will want to set up their editor to start the server automatically when editing supported files. See the editor integration instructions below.
Neovim
Install Panache through Mason with :MasonInstall panache, or use one of the CLI installation methods. The executable must be available to Neovim on PATH.
With Neovim 0.11 or later and a current nvim-lspconfig installed, enable its built-in Panache configuration in your init.lua:
vim.lsp.enable("panache")The configuration recognizes the markdown, quarto, and rmd filetypes and starts panache lsp. Mason installs the binary; enabling the LSP configuration connects it to your buffers.
Without nvim-lspconfig, define the configuration directly before enabling it:
vim.lsp.config("panache", {
cmd = { "panache", "lsp" },
filetypes = { "markdown", "quarto", "rmd" },
root_markers = {
".panache.toml",
"panache.toml",
"_quarto.yml",
"_bookdown.yml",
".git",
},
})
vim.lsp.enable("panache")For mdsvex files, register their filetype and add it to the server configuration before enabling the server:
vim.filetype.add({
extension = { svx = "mdsvex" },
pattern = { [".*%.svelte%.md"] = "mdsvex" },
})
vim.lsp.config("panache", {
filetypes = { "markdown", "quarto", "rmd", "mdsvex" },
})To format on save:
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = { "*.qmd", "*.md", "*.Rmd", "*.rmd", "*.svx", "*.svelte.md" },
callback = function()
vim.lsp.buf.format({ name = "panache", async = false })
end,
})Format the current buffer with :lua vim.lsp.buf.format({ name = "panache" }).
Conform
conform.nvim includes a Panache formatter. With Panache installed on PATH, add it to your Conform setup:
require("conform").setup({
formatters_by_ft = {
markdown = { "panache" },
quarto = { "panache" },
rmd = { "panache" },
mdsvex = { "panache" },
},
format_on_save = { timeout_ms = 3000 },
})Conform sends the buffer and filename to Panache, so flavor detection and project configuration apply. If you enable Conform’s format-on-save option, omit the LSP formatting autocmd above to avoid formatting twice. The language server can still provide diagnostics and navigation.
RStudio
The Panache R package provides an in-process formatter and RStudio addins. It is in early development. Install the development version from GitHub; building from source requires Cargo and Rust 1.89 or newer:
install.packages(c("remotes", "rstudioapi"))
remotes::install_github("jolars/panache-r")Choose Format with Panache or Format Selection with Panache from RStudio’s Addins menu to format the active document or selected blocks. The addins work on editor contents and discover panache.toml from the document’s directory. They leave the edits for you to save.
The package formats R code blocks through the Arity R package by default. Explicitly configured external formatter commands must be installed on PATH. It provides formatting; use the CLI or an LSP editor for Panache’s lint checks. See the R package documentation for function arguments, configuration overrides, and addin options.
VS Code
Install the VS Code Marketplace extension. The extension starts the language server automatically for supported files.
To install through the command line, run:
code --install-extension jolars.panacheIf you prefer to install from the VS Code UI, launch VS Code Quick Open (Ctrl+P), then run:
ext install jolars.panacheThe extension launches panache lsp automatically.
Optional extension settings:
{
"panache.commandPath": "panache",
"panache.downloadBinary": true,
"panache.releaseTag": "latest",
"panache.serverArgs": [],
"panache.serverEnv": { "RUST_LOG": "info" },
"panache.trace.server": "off"
}Open VSX (Positron, Cursor, VSCodium, etc.)
Install the Open VSX extension. The extension starts the language server automatically for supported files.
The Open VSX extension is identical to the VS Code extension and uses the same configuration settings, so see the VS Code section above for configuration instructions.
Zed
Install the Panache extension from the extensions view (zed: extensions in the command palette). Markdown is built into Zed, and Quarto comes from the Quarto extension, which you need installed first. Zed has no R Markdown language extension, so Panache’s R Markdown support is unavailable there for now.
Zed uses the panache on your PATH when there is one, and otherwise downloads the release binary matching your platform. Keeping Panache on the PATH is the better option on distributions that cannot run the generic release build, NixOS above all.
To format on save, add to settings.json:
{
"languages": {
"Markdown": {
"formatter": "language_server",
"format_on_save": "on"
}
}
}Formatting and linting options come from panache.toml (see Configuration). Zed’s lsp settings block cannot supply them: the server reads its configuration from disk and accepts no formatting settings over LSP.
To point Zed at a particular binary, set binary.path:
{
"lsp": {
"panache-language-server": {
"binary": { "path": "/opt/panache/bin/panache", "arguments": ["lsp"] }
}
}
}Helix
Add to ~/.config/helix/languages.toml:
[[language]]
name = "markdown"
language-servers = ["panache"]
auto-format = true
[[language]]
name = "quarto"
language-servers = ["panache"]
auto-format = true
[[language]]
name = "rmarkdown"
language-servers = ["panache"]
auto-format = true
[language-server.panache]
command = "panache"
args = ["lsp"]Format the current file with :format or <space>f.
Emacs
Using lsp-mode:
(require 'lsp-mode)
;; Define panache LSP client
(lsp-register-client
(make-lsp-client
:new-connection (lsp-stdio-connection '("panache" "lsp"))
:activation-fn (lsp-activate-on "quarto" "markdown" "rmarkdown")
:server-id 'panache))
;; Enable for specific modes
(add-hook 'markdown-mode-hook #'lsp-deferred)
(add-hook 'quarto-mode-hook #'lsp-deferred)
;; Format on save
(add-hook 'before-save-hook #'lsp-format-buffer nil t)
Sublime Text
Using LSP package:
- Install LSP package
- Add to LSP settings:
{
"clients": {
"panache": {
"enabled": true,
"command": ["panache", "lsp"],
"selector": "text.html.markdown | source.quarto"
}
}
}Kate
Kate supports LSP servers via its LSP client plugin:
- Enable the LSP Client plugin
- Add to LSP client configuration:
{
"servers": {
"markdown": {
"command": ["panache", "lsp"],
"highlightingModeRegex": "^Markdown$"
}
}
}Project Configuration
Put formatting and linting settings in panache.toml. The language server reads these settings from disk, so they apply across editors and the CLI. See Configuration for project setup and Configuration Discovery for precedence and reload behavior.
To use a custom user config in VS Code, set the environment variable in your user settings.json:
{
"panache.serverEnv": {
"PANACHE_CONFIG": "P:/Softwares/panache.toml"
}
}Run Panache: Restart Server after changing panache.serverEnv. Project configs take precedence over this fallback. A missing or invalid PANACHE_CONFIG file is reported as a configuration error, and formatting is refused until it is fixed.
Semantic Tokens
Panache uses custom semantic-token types for Pandoc and Quarto syntax. Map these types to colors in your editor to enable the additional highlighting. See Semantic Tokens for the supported syntax and flavor behavior.
In VS Code (settings.json):
"editor.semanticTokenColorCustomizations": {
"enabled": true,
"rules": {
"citation": "#c586c0",
"crossref": "#4ec9b0",
"shortcode": "#dcdcaa",
"div": "#569cd6",
"math": "#ce9178",
"footnote": "#9cdcfe",
"attribute": "#b5cea8"
}
}In Neovim, link the LSP semantic-token groups to your colorscheme:
for token, group in pairs({
citation = "@markup.link",
crossref = "@markup.link.label",
shortcode = "@function.macro",
div = "@keyword.directive",
math = "@markup.math",
footnote = "@markup.link.label",
attribute = "@attribute",
}) do
vim.api.nvim_set_hl(0, "@lsp.type." .. token, { link = group })
endTroubleshooting
LSP Not Starting
Check that panache is in your PATH:
which panacheTest the LSP manually:
panache lsp
# Should start and wait for JSON-RPC inputFormatting Not Working
Enable LSP logging in your editor to see error messages:
Neovim
vim.lsp.set_log_level("debug")
-- View logs: :lua vim.cmd('e'..vim.lsp.get_log_path())VS Code
Set "panache.trace.server": "verbose" in settings.
Configuration Not Loading
Verify your config file is valid by testing with the CLI first:
panache format --config .panache.toml test.qmdConfiguration discovery starts from the document’s directory. See Configuration Discovery for precedence and reload behavior.