使用VS code调试Quarto官网示例ipynb文件

AI 时代程序员必备技能

Codex、Claude Code、Cursor、Hermes Agent、OpenClaw等工程化实战专栏 ,讲透 AI 如何接管脏活累活

以下摘自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文件即可得到
      在这里插入图片描述

参考链接
Quarto官网
Quarto下载及Guide
Quarto官方Notebook示例

AI 时代程序员必备技能

Codex、Claude Code、Cursor、Hermes Agent、OpenClaw等工程化实战专栏 ,讲透 AI 如何接管脏活累活

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值