codefocus
CodeFocus for Quarto Revealjs. Use when creating presentations with progressive code highlighting.
安装与使用
请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。
查看来源 ↗使用指南技能说明
CodeFocus for Quarto Revealjs
Use this syntax to add progressive code highlighting with explanations in Quarto revealjs presentations.
When to use
- When creating Quarto revealjs presentations
- When you need step-by-step code walkthroughs
- When teaching code concepts progressively
Setup
- Install the extension:
quarto add reuning/codefocus
- Add to
_quarto.yml:
revealjs-plugins:
- codefocus
Instructions
Syntax
## Slide Title
```python
import requests
import json
api_url = "https://api.example.com/data"
headers = {"Authorization": "Bearer token"}
response = requests.get(api_url, headers=headers)
data = response.json()
```
::: {.fragment .current-only data-code-focus="1-2"}
First, we import the required libraries for HTTP requests and JSON handling.
:::
::: {.fragment .current-only data-code-focus="4-5"}
Define the API endpoint URL and authentication headers.
:::
::: {.fragment .current-only data-code-focus="7-8"}
Make the GET request and parse the JSON response.
:::
Key Attributes
-
.fragment- Makes content appear progressively -
.current-only- Fragment disappears when advancing (keeps slide clean) -
data-code-focus="N"- Line number to highlight (1-indexed) -
data-code-focus="1-3"- Range of lines -
data-code-focus="1,3,5"- Multiple specific lines
Notes
- Code block must come BEFORE the fragment divs
- Each fragment highlights different lines as you press arrow keys
- The explanation text appears below the code when that fragment is active
使用示例
查看来源仓库中的使用示例与配置说明。
查看来源 ↗来源历史
- 收录时间
- 2026-03-11
- 索引更新时间
- 2026-03-11
- Branch
- main
收录与同步日期属于本站记录。源码修改历史请查看来源仓库。
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!