Quarto-mode
is an emacs mode for editing quarto documents.
quarto-mode
is available on MELPA. From emacs,
M-x package-refresh-contents
M-x package-install
quarto-mode
Add this to your .emacs
or ~/.emacs.d/init.el
file:
;; load the library
(require 'quarto-mode)
The quarto-mode
package will associate a quarto polymode to .qmd
files.
That means that there isn't an actual quarto-mode
mode.
If you want to associate other files to the quarto polymode, you should use poly-quarto-mode
, such as:
;; Note that the following is not necessary to run quarto-mode in .qmd files! It's merely illustrating
;; how to associate different extensions to the mode.
(add-to-list 'auto-mode-alist '("\\.Rmd\\'" . poly-quarto-mode))
;; Or, with use-package:
(use-package quarto-mode
:mode (("\\.Rmd" . poly-quarto-mode))
)
Quarto-mode requires the following packages to be installed:
(polymode "0.2.2")
(poly-markdown "0.2.2")
(markdown-mode "2.3")
(request "0.3.2")
If you have ESS, quarto-mode
will use it. Otherwise, it won't. Specifically, quarto-mode
does not depend on ESS (or R), which means that if you want to use those features, you have to install ESS separately.
M-x quarto-preview
. Start aquarto preview
server. If the current buffer has an associated file that exists in a quarto project, the command will preview the entire project. Otherwise, it will preview the specific file.- Integration with poly-markdown's compilation. The default poly-markdown configuration runs plain
pandoc
on the document;quarto-mode
usesquarto render
.
-
C-c C-c *
behaviorquarto-mode
uses features specific to quarto that make it behave differently from whatmarkdown-mode
users might expect. By default,quarto-mode
usesquarto preview
, which works through a custom web server, and does not produce disk output upon preview.quarto preview
is significantly faster than rerendering entire files in interactive mode, so we encourage you to use it.However, if you wish to not use
quarto preview
and instead depend on the typical rendering mode of previewing, you can restore the standardmarkdown-mode
behavior by changing thequarto-force-preview
customization variable.