以下摘自Quarto官网的介绍
- An open-source scientific and technical publishing system
- Author using Jupyter notebooks or with plain text markdown in your favorite editor.
- Create dynamic content with Python, R, Julia, and Observable.
- Publish reproducible, production quality articles, presentations, dashboards, websites, blogs, and books in HTML, PDF, MS Word, ePub, and more.
- Share knowledge and insights organization-wide by publishing to Posit Connect, Confluence, or other publishing systems.
- Write using Pandoc markdown, including equations, citations, crossrefs, figure panels, callouts, advanced layout, and more.
今天看到写作工具Quarto可以同时写作和调试R/Python,并且还提供其他写作中的功能,比如交叉引用等等功能,就来尝试用Cursor/VScode调试Quarto官网的demo代码,测试如何在VScode和Jupyter中写作Quarto并输出HTML文件
Quarto下载及插件安装
- 首先需要在官方 Quarto下载界面上点击下载安装包并完成安装

- 接着需要在vscode/cursor中安装extension

官网示例Demo code调试
以下是 Quarto官网选择R时出现的示例代码
---
title: "ggplot2 demo"
author: "Norah Jones"
date: "5/22/2021"
format:
html:
fig-width: 8
fig-height: 4
code-fold: true
---
## Air Quality
@fig-airquality further explores the impact of temperature on ozone level.
```{r}
#| label: fig-airquality
#| fig-cap: "Temperature and ozone level."
#| warning: false
library(ggplot2)
ggplot(airquality, aes(Temp, Ozone)) +
geom_point() +
geom_smooth(method = "loess")
- 新建文件并保存为.qmd文档
- 点击代码右上角preview即可预览文档

- 同时在同一文件夹内也出现了同名HTML文档

官网ipynb文件调试
-
点击Quarto官方Notebook示例找到hello.ipynb下载
-
选择合适的文件夹存放ipynb文件,并为ipynb文件选择kernel,这里选择python环境

-
在Cursor/VScode中新建终端,使用Cmd+Shift+P,选create new terminal

-
在终端中进入当前文件夹(可以使用绝对路径)
cd [----filepath----] -
进入文件按照官网提示,在终端中执行以下命令,即可在同文件夹中得到同名HTML文件
quarto render hello.ipynb --execute
- 调试HTML文件即可得到

- 调试HTML文件即可得到
7381

被折叠的 条评论
为什么被折叠?



