revealjs

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Reveal.js Presentations

Reveal.js 演示文稿

Create HTML presentations using reveal.js. No build step required - just open the HTML in a browser.
使用reveal.js创建HTML演示文稿。无需构建步骤 - 只需在浏览器中打开HTML文件即可。

What You Create

你将创建的内容

A reveal.js presentation consists of:
  1. HTML file - Contains slides and loads reveal.js from CDN
  2. CSS file - Custom styles for layouts, colors, typography, and components
一个reveal.js演示文稿包含:
  1. HTML文件 - 包含幻灯片内容,并从CDN加载reveal.js
  2. CSS文件 - 用于布局、颜色、排版和组件的自定义样式

Design Principles

设计原则

CRITICAL: Before creating any presentation, analyze the content and choose appropriate design elements:
  1. Consider the subject matter: What is this presentation about? What tone, industry, or mood does it suggest?
  2. Check for branding: If the user mentions a company/organization, consider their brand colors and identity
  3. Match palette to content: Select colors that reflect the subject
  4. State your approach: Explain your design choices before writing code
Requirements:
  • ✅ State your content-informed design approach BEFORE writing code
  • ✅ Use web-safe fonts (Arial, Helvetica, Georgia, Verdana, etc.) or Google Fonts via
    @import
    in CSS
  • ✅ Create clear visual hierarchy through size, weight, and color
  • ✅ Ensure readability: strong contrast, appropriately sized text, clean alignment
  • ✅ Be consistent: repeat patterns, spacing, and visual language across slides
  • Always use
    pt
    (points) for font sizes
    - slides are fixed-size, so
    pt
    is predictable and familiar (like PowerPoint/Keynote). Never use
    em
    ,
    rem
    , or
    px
    for font sizes.
关键提示:在创建任何演示文稿之前,先分析内容并选择合适的设计元素:
  1. 考虑主题内容:这个演示文稿是关于什么的?它需要呈现何种基调、行业或氛围?
  2. 检查品牌要求:如果用户提到公司/组织,考虑其品牌颜色和标识
  3. 配色匹配内容:选择能反映主题的颜色
  4. 说明你的设计思路:在编写代码之前,先解释你的设计选择
要求:
  • ✅ 在编写代码之前,先说明基于内容的设计思路
  • ✅ 使用网络安全字体(Arial、Helvetica、Georgia、Verdana等)或通过CSS中的
    @import
    引入Google Fonts
  • ✅ 通过字号、字重和颜色创建清晰的视觉层次
  • ✅ 确保可读性:强烈的对比度、合适的字号、整洁的对齐方式
  • ✅ 保持一致性:在所有幻灯片中重复使用相同的布局模式、间距和视觉语言
  • 始终使用
    pt
    (磅)作为字号单位
    - 幻灯片是固定尺寸的,因此
    pt
    像PowerPoint/Keynote一样可预测且易于理解。绝不要使用
    em
    rem
    px
    作为字号单位。

Color Palette Selection

配色方案选择

Choosing colors creatively:
  • Think beyond defaults: What colors genuinely match this specific topic? Avoid autopilot choices.
  • Consider multiple angles: Topic, industry, mood, energy level, target audience, brand identity (if mentioned)
  • Be adventurous: Try unexpected combinations - a healthcare presentation doesn't have to be green, finance doesn't have to be navy
  • Build your palette: Pick 3-5 colors that work together (dominant colors + supporting tones + accent)
  • Ensure contrast: Text must be clearly readable on backgrounds
Example color palettes (use these to spark creativity - choose one, adapt it, or create your own):
  1. Classic Blue: Deep navy (#1C2833), slate gray (#2E4053), silver (#AAB7B8), off-white (#F4F6F6)
  2. Teal & Coral: Teal (#5EA8A7), deep teal (#277884), coral (#FE4447), white (#FFFFFF)
  3. Bold Red: Red (#C0392B), bright red (#E74C3C), orange (#F39C12), yellow (#F1C40F), green (#2ECC71)
  4. Warm Blush: Mauve (#A49393), blush (#EED6D3), rose (#E8B4B8), cream (#FAF7F2)
  5. Burgundy Luxury: Burgundy (#5D1D2E), crimson (#951233), rust (#C15937), gold (#997929)
  6. Deep Purple & Emerald: Purple (#B165FB), dark blue (#181B24), emerald (#40695B), white (#FFFFFF)
  7. Cream & Forest Green: Cream (#FFE1C7), forest green (#40695B), white (#FCFCFC)
  8. Pink & Purple: Pink (#F8275B), coral (#FF574A), rose (#FF737D), purple (#3D2F68)
  9. Lime & Plum: Lime (#C5DE82), plum (#7C3A5F), coral (#FD8C6E), blue-gray (#98ACB5)
  10. Black & Gold: Gold (#BF9A4A), black (#000000), cream (#F4F6F6)
  11. Sage & Terracotta: Sage (#87A96B), terracotta (#E07A5F), cream (#F4F1DE), charcoal (#2C2C2C)
  12. Charcoal & Red: Charcoal (#292929), red (#E33737), light gray (#CCCBCB)
  13. Vibrant Orange: Orange (#F96D00), light gray (#F2F2F2), charcoal (#222831)
  14. Forest Green: Black (#191A19), green (#4E9F3D), dark green (#1E5128), white (#FFFFFF)
  15. Retro Rainbow: Purple (#722880), pink (#D72D51), orange (#EB5C18), amber (#F08800), gold (#DEB600)
  16. Vintage Earthy: Mustard (#E3B448), sage (#CBD18F), forest green (#3A6B35), cream (#F4F1DE)
  17. Coastal Rose: Old rose (#AD7670), beaver (#B49886), eggshell (#F3ECDC), ash gray (#BFD5BE)
  18. Orange & Turquoise: Light orange (#FC993E), grayish turquoise (#667C6F), white (#FCFCFC)
创意选择颜色:
  • 超越默认选项:哪些颜色真正匹配这个特定主题?避免机械选择。
  • 考虑多个角度:主题、行业、氛围、活力水平、目标受众、品牌标识(如果提及)
  • 勇于尝试:尝试意想不到的组合 - 医疗演示不一定必须是绿色,金融演示不一定必须是深蓝色
  • 构建你的配色方案:选择3-5种搭配和谐的颜色(主色调 + 辅助色调 + 强调色)
  • 确保对比度:文本在背景上必须清晰可读
示例配色方案(用于激发创意 - 选择一种、调整或自行创建):
  1. 经典蓝色:深藏青(#1C2833)、石板灰(#2E4053)、银色(#AAB7B8)、米白(#F4F6F6)
  2. 蓝绿色与珊瑚色:蓝绿色(#5EA8A7)、深绿蓝(#277884)、珊瑚色(#FE4447)、白色(#FFFFFF)
  3. 醒目红色:红色(#C0392B)、亮红色(#E74C3C)、橙色(#F39C12)、黄色(#F1C40F)、绿色(#2ECC71)
  4. 暖腮红:淡紫色(#A49393)、腮红粉(#EED6D3)、玫瑰粉(#E8B4B8)、奶油色(#FAF7F2)
  5. 勃艮第奢华风:勃艮第红(#5D1D2E)、深红色(#951233)、铁锈红(#C15937)、金色(#997929)
  6. 深紫与祖母绿:紫色(#B165FB)、深蓝色(#181B24)、祖母绿(#40695B)、白色(#FFFFFF)
  7. 奶油色与森林绿:奶油色(#FFE1C7)、森林绿(#40695B)、白色(#FCFCFC)
  8. 粉色与紫色:粉色(#F8275B)、珊瑚色(#FF574A)、玫瑰色(#FF737D)、紫色(#3D2F68)
  9. 石灰绿与李子紫:石灰绿(#C5DE82)、李子紫(#7C3A5F)、珊瑚色(#FD8C6E)、蓝灰色(#98ACB5)
  10. 黑金配色:金色(#BF9A4A)、黑色(#000000)、奶油色(#F4F6F6)
  11. 鼠尾草绿与赤陶色:鼠尾草绿(#87A96B)、赤陶色(#E07A5F)、奶油色(#F4F1DE)、炭灰色(#2C2C2C)
  12. 炭灰与红色:炭灰色(#292929)、红色(#E33737)、浅灰色(#CCCBCB)
  13. 活力橙色:橙色(#F96D00)、浅灰色(#F2F2F2)、炭灰色(#222831)
  14. 森林绿:黑色(#191A19)、绿色(#4E9F3D)、深绿色(#1E5128)、白色(#FFFFFF)
  15. 复古彩虹:紫色(#722880)、粉色(#D72D51)、橙色(#EB5C18)、琥珀色(#F08800)、金色(#DEB600)
  16. 复古大地色:芥末黄(#E3B448)、鼠尾草绿(#CBD18F)、森林绿(#3A6B35)、奶油色(#F4F1DE)
  17. 海岸玫瑰色:旧玫瑰色(#AD7670)、海狸棕(#B49886)、蛋壳色(#F3ECDC)、灰绿色(#BFD5BE)
  18. 橙色与绿松石色:浅橙色(#FC993E)、灰绿松石色(#667C6F)、白色(#FCFCFC)

Slide Content Principles

幻灯片内容原则

Diverse presentation is key. Even when slides have similar content types, vary the visual presentation:
  • Use different layouts across slides: columns on one, stacked boxes on another, callouts with icons on a third
  • Mix container styles: plain text, boxes, callouts, blockquotes
  • Use visual hierarchy:
    <strong>
    for key terms, different colors to distinguish categories
  • Break up lists with other elements (quotes, callouts, columns)
  • Don't repeat the same layout pattern on consecutive slides
Keep it scannable:
  • Short bullet points, not paragraphs
  • One main idea per slide when possible
  • Use icons (Font Awesome) to add visual interest
When a slide has less content, make it bigger - don't leave empty space with tiny text.
多样化呈现是关键。即使幻灯片内容类型相似,也要改变视觉呈现方式:
  • 在不同幻灯片中使用不同布局:一张用分栏,另一张用堆叠框,第三张用带图标提示框
  • 混合容器样式:纯文本、盒子、提示框、引用块
  • 使用视觉层次:用
    <strong>
    标记关键术语,用不同颜色区分类别
  • 用其他元素(引用、提示框、分栏)拆分列表
  • 不要在连续幻灯片中重复相同的布局模式
保持易读性:
  • 简短的项目符号,不要用段落
  • 尽可能每张幻灯片一个核心观点
  • 使用图标(Font Awesome)增加视觉趣味
当幻灯片内容较少时,放大内容 - 不要留着空白区域却用小字体。

Workflow

工作流程

Step 1: Plan the Structure

步骤1:规划结构

Based on the user's content, determine:
  • How many slides are needed
  • Which slides should be section dividers (centered, larger text)
  • Where to use vertical slide stacks for drill-down content
根据用户的内容,确定:
  • 需要多少张幻灯片
  • 哪些幻灯片作为章节分隔符(居中、大号字体)
  • 哪里使用垂直幻灯片组来展示深入内容

Step 2: Extract Template

步骤2:提取模板

Use the
create-presentation.js
script (located in the
scripts/
directory next to this SKILL.md file) to extract and customize a presentation template from
template.zip
.
bash
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,d,3,1,d,1 --title "My Presentation" --output-dir ./presentations
Finding the script path: The script is at
scripts/create-presentation.js
relative to where this SKILL.md file is located. Common locations:
  • Project skill:
    .claude/skills/revealjs/scripts/create-presentation.js
  • User skill:
    ~/.claude/skills/revealjs/scripts/create-presentation.js
Options:
  • --slides N
    - Create N horizontal slides (simple mode)
  • --structure <list>
    - Mixed layout with comma-separated values:
    • 1
      = single horizontal slide
    • N
      (where N > 1) = vertical stack of N slides
    • d
      = section divider slide (centered, no content wrapper)
  • --output-dir, -o <dir>
    - Output directory for deck folder (default: current directory)
  • --title <text>
    - Presentation title (default: Presentation)
  • --slug <text>
    - Custom slug for deck folder (default: random hex)
What gets created: The script extracts
template.zip
to a folder named
deck-{slug}/
containing:
  • index.html
    - The presentation HTML file
  • lib/
    - reveal.js library, plugins, fonts, and CSS (all dependencies included, no CDN needed)
  • assets/
    - Folder for images, documents, and other assets (created automatically)
Examples:
bash
undefined
使用
create-presentation.js
脚本(位于本SKILL.md文件旁的
scripts/
目录中)从
template.zip
提取并自定义演示文稿模板。
bash
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,d,3,1,d,1 --title "My Presentation" --output-dir ./presentations
查找脚本路径:脚本位于本SKILL.md文件相对路径的
scripts/create-presentation.js
。常见位置:
  • 项目技能:
    .claude/skills/revealjs/scripts/create-presentation.js
  • 用户技能:
    ~/.claude/skills/revealjs/scripts/create-presentation.js
选项:
  • --slides N
    - 创建N张水平幻灯片(简单模式)
  • --structure <list>
    - 混合布局,用逗号分隔值:
    • 1
      = 单张水平幻灯片
    • N
      (N>1)= N张幻灯片组成的垂直组
    • d
      = 章节分隔符幻灯片(居中,无内容容器)
  • --output-dir, -o <dir>
    - 演示文稿文件夹的输出目录(默认:当前目录)
  • --title <text>
    - 演示文稿标题(默认:Presentation)
  • --slug <text>
    - 演示文稿文件夹的自定义标识(默认:随机十六进制字符串)
创建的内容: 脚本将
template.zip
提取到名为
deck-{slug}/
的文件夹中,包含:
  • index.html
    - 演示文稿HTML文件
  • lib/
    - reveal.js库、插件、字体和CSS(包含所有依赖项,无需CDN)
  • assets/
    - 用于存放图片、文档和其他资源的文件夹(自动创建)
示例:
bash
undefined

10 horizontal slides in ./presentations directory

在./presentations目录中创建10张水平幻灯片

node <path-to-skill>/scripts/create-presentation.js --slides 10 --output-dir ./presentations
node <path-to-skill>/scripts/create-presentation.js --slides 10 --output-dir ./presentations

Mixed structure: intro, 2 content slides, divider, 3-slide vertical stack, divider, closing

混合结构:介绍、2张内容幻灯片、分隔符、3张垂直幻灯片组、分隔符、结束语

node <path-to-skill>/scripts/create-presentation.js --structure 1,1,1,d,3,d,1 --title "Q4 Review" --output-dir ./decks
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,1,d,3,d,1 --title "Q4 Review" --output-dir ./decks

Custom slug

自定义标识

node <path-to-skill>/scripts/create-presentation.js --structure 1,1,1,d,3,d,1,1 --title "My Deck" --slug mydeck
undefined
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,1,d,3,d,1,1 --title "My Deck" --slug mydeck
undefined

Step 3: Customize the CSS

步骤3:自定义CSS

The template includes all necessary CSS in
lib/offline-v2.css
. You can customize styles by:
  1. Editing
    lib/offline-v2.css
    directly
    - This file contains all reveal.js styles and theme variables
  2. Adding a custom CSS file - Link your own CSS file in
    index.html
    after the main stylesheet
Template includes local fonts in
lib/fonts/
- no need for Google Fonts CDN. Available fonts include:
  • Montserrat (default theme font)
  • Overpass, Overpass2
  • Lato
  • Open Sans
  • And many more (see
    lib/fonts/
    directory)
Using Google Fonts (optional): If you prefer Google Fonts, add an
@import
in a custom CSS file:
css
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Lato:wght@300;400;600&display=swap');

.reveal {
  font-family: "Lato", Helvetica, sans-serif;
}

.reveal h1, .reveal h2, .reveal h3 {
  font-family: "Playfair Display", Georgia, serif;
}
Typography guidance:
  • Always use
    pt
    (points) for font sizes
    - slides are fixed-size, so
    pt
    is predictable and familiar (like PowerPoint/Keynote)
  • Base text should be around 16-18pt for readability
  • When a slide has less content, increase font sizes to fill space appropriately
  • Use larger sizes (24pt, 32pt, 48pt) for headings based on hierarchy
Custom CSS example: Create a
custom.css
file in your deck folder and add it to
index.html
:
html
<link rel="stylesheet" type="text/css" href="lib/offline-v2.css">
<link rel="stylesheet" type="text/css" href="custom.css">
Then customize in
custom.css
:
css
.reveal .slides section {
  padding: 40px 60px;
  text-align: left;
}

.reveal h1 { font-size: 48pt; }
.reveal h2 { font-size: 36pt; }
.reveal h3 { font-size: 24pt; }
.reveal p, .reveal li { font-size: 16pt; }
IMPORTANT - CSS Integration: When you create custom CSS files (like
custom.css
), they will be automatically integrated into
lib/offline-v2.css
when you run the finalization script (Step 7). The finalization script will:
  • Append all custom CSS files to
    lib/offline-v2.css
  • Remove external CSS file references from
    index.html
  • Delete the separate custom CSS files
This ensures a single, consolidated CSS file for easier distribution.
模板在
lib/offline-v2.css
中包含所有必要的CSS。你可以通过以下方式自定义样式:
  1. 直接编辑
    lib/offline-v2.css
    - 该文件包含所有reveal.js样式和主题变量
  2. 添加自定义CSS文件 - 在
    index.html
    中主样式表之后链接你自己的CSS文件
模板包含本地字体
lib/fonts/
目录中 - 无需Google Fonts CDN。可用字体包括:
  • Montserrat(默认主题字体)
  • Overpass、Overpass2
  • Lato
  • Open Sans
  • 更多字体(见
    lib/fonts/
    目录)
使用Google Fonts(可选):如果你偏好Google Fonts,在自定义CSS文件中添加
@import
css
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Lato:wght@300;400;600&display=swap');

.reveal {
  font-family: "Lato", Helvetica, sans-serif;
}

.reveal h1, .reveal h2, .reveal h3 {
  font-family: "Playfair Display", Georgia, serif;
}
排版指南:
  • 始终使用
    pt
    (磅)作为字号单位
    - 幻灯片是固定尺寸的,因此
    pt
    像PowerPoint/Keynote一样可预测且易于理解
  • 基础文本应为16-18pt以保证可读性
  • 当幻灯片内容较少时,适当增大字号以填充空间
  • 根据层次结构使用更大的字号(24pt、32pt、48pt)作为标题
自定义CSS示例: 在演示文稿文件夹中创建
custom.css
文件,并将其添加到
index.html
中:
html
<link rel="stylesheet" type="text/css" href="lib/offline-v2.css">
<link rel="stylesheet" type="text/css" href="custom.css">
然后在
custom.css
中自定义:
css
.reveal .slides section {
  padding: 40px 60px;
  text-align: left;
}

.reveal h1 { font-size: 48pt; }
.reveal h2 { font-size: 36pt; }
.reveal h3 { font-size: 24pt; }
.reveal p, .reveal li { font-size: 16pt; }
重要提示 - CSS集成:当你创建自定义CSS文件(如
custom.css
)时,在运行最终脚本(步骤7)时它们将自动集成到
lib/offline-v2.css
中。最终脚本将:
  • 将所有自定义CSS文件的内容附加到
    lib/offline-v2.css
    中,并添加清晰的标记
  • 删除单独的CSS文件
  • index.html
    中移除外部CSS文件的引用(仅保留
    lib/offline-v2.css
这确保了单个整合的CSS文件,便于分发。

Step 4: Fill in the HTML Content

步骤4:填充HTML内容

Edit the
index.html
file in your deck folder to add content to each slide. Always use HTML markup, never markdown (even though the template includes a markdown plugin). Follow these patterns:
Standard slide structure:
html
<section id="unique-slide-id">
  <h2>Slide Title</h2>
  <div class="content">
    <!-- Content here -->
  </div>
</section>
Multi-column layouts - always use inline CSS grid (do NOT create utility classes like
.grid-2
):
html
<!-- Equal columns -->
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px;">
  <div>Column 1</div>
  <div>Column 2</div>
</div>

<!-- Three columns -->
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px;">
  <div>Column 1</div>
  <div>Column 2</div>
  <div>Column 3</div>
</div>

<!-- Unequal columns -->
<div style="display: grid; grid-template-columns: 1fr 2fr; gap: 30px;">
  <div>Narrow sidebar</div>
  <div>Wide main content</div>
</div>
Why inline styles for grids? Each slide's layout needs vary - column ratios, gaps, etc. Inline styles give you full control per-slide without creating dozens of utility classes.
Important HTML patterns:
  • Every
    <section>
    should have a unique
    id
    attribute for stable identification
  • Use
    class="section-divider"
    for centered section title slides
  • Wrap main content in
    <div class="content">
    for consistent spacing. This is a flexbox container that fills the remaining vertical space below the title, ensuring content flows properly.
  • Use
    <div class="footnote">
    for attribution or source text at bottom
编辑演示文稿文件夹中的
index.html
文件,为每张幻灯片添加内容。始终使用HTML标记,不要使用markdown(尽管模板包含markdown插件)。遵循以下模式:
标准幻灯片结构:
html
<section id="unique-slide-id">
  <h2>幻灯片标题</h2>
  <div class="content">
    <!-- 内容在这里 -->
  </div>
</section>
多列布局 - 始终使用内联CSS网格(不要创建
.grid-2
这样的工具类):
html
<!-- 等宽列 -->
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px;">
  <div>列1</div>
  <div>列2</div>
</div>

<!-- 三列 -->
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px;">
  <div>列1</div>
  <div>列2</div>
  <div>列3</div>
</div>

<!-- 不等宽列 -->
<div style="display: grid; grid-template-columns: 1fr 2fr; gap: 30px;">
  <div>窄侧边栏</div>
  <div>宽主内容</div>
</div>
为什么网格使用内联样式?每张幻灯片的布局需求不同 - 列比例、间距等。内联样式让你对每张幻灯片有完全的控制,无需创建几十个工具类。
重要HTML模式:
  • 每个
    <section>
    都应有唯一的
    id
    属性,以便稳定识别
  • 对居中的章节标题幻灯片使用
    class="section-divider"
  • 将主要内容包裹在
    <div class="content">
    中以保证一致的间距。这是一个flexbox容器,填充标题下方的剩余垂直空间,确保内容正确排列。
  • 使用
    <div class="footnote">
    添加底部的署名或来源文本

Step 5: Check for Content Overflow

步骤5:检查内容溢出

Run the overflow checker to ensure no slides have content that extends beyond boundaries:
bash
node <path-to-skill>/scripts/check-overflow.js deck-{slug}/index.html
Note: Replace
deck-{slug}
with your actual deck folder name.
The script checks each slide for:
  • Vertical overflow: Content taller than slide height
  • Horizontal overflow: Content wider than slide width
If overflow is detected, reduce content or adjust font sizes on affected slides.
运行溢出检查器,确保没有幻灯片的内容超出边界:
bash
node <path-to-skill>/scripts/check-overflow.js deck-{slug}/index.html
注意:将
deck-{slug}
替换为你实际的演示文稿文件夹名称。
脚本检查每张幻灯片的:
  • 垂直溢出:内容高度超过幻灯片高度
  • 水平溢出:内容宽度超过幻灯片宽度
如果检测到溢出,减少内容或调整受影响幻灯片的字号。

Step 6: Visual Review with Screenshots

步骤6:通过截图进行视觉审查

CRITICAL: You MUST review screenshots of EVERY SINGLE SLIDE. Do not skip slides or review only a sample. Visual issues are common and can only be caught by examining each slide individually.
Capture screenshots of all slides:
bash
cd deck-{slug}
npx decktape reveal "index.html?export" output.pdf \
  --screenshots \
  --screenshots-directory "screenshots/$(date +%Y%m%d_%H%M%S)"
Note: The
?export
query parameter disables chart animations for cleaner PDF rendering. Charts will still animate when viewing the HTML directly in a browser.
This creates a timestamped folder (e.g.,
screenshots/20241210_143052/
) so you can track versions and compare before/after fixes.
Then use the Read tool to examine each screenshot image file.
**关键提示:你必须审查每一张幻灯片的截图。**不要跳过幻灯片或只审查样本。视觉问题很常见,只能通过逐一检查每张幻灯片来发现。
捕获所有幻灯片的截图:
bash
cd deck-{slug}
npx decktape reveal "index.html?export" output.pdf \
  --screenshots \
  --screenshots-directory "screenshots/$(date +%Y%m%d_%H%M%S)"
注意
?export
查询参数禁用图表动画,以便更清晰地渲染PDF。直接在浏览器中查看HTML时,图表仍会有动画效果。
这会创建一个带时间戳的文件夹(例如
screenshots/20241210_143052/
),让你可以跟踪版本并比较修复前后的效果。
然后使用读取工具检查每个截图文件。

What to Look For

检查要点

The overflow script catches most layout issues, but these problems require visual inspection:
  1. Color inheritance in containers: Text inside boxes or callouts may inherit the wrong color from parent elements. If you have light text on a dark page background, text inside a light-colored
    .box
    or
    .callout
    will be unreadable unless you explicitly set dark text color for that container.
    Fix pattern - explicitly set text and bullet colors for light containers:
    css
    .box-light p,
    .box-light li {
      color: var(--text-dark);
    }
    
    .box-light ul li::before {
      background: var(--primary-color);  /* bullet color */
    }
  2. Custom bullet/list styling: If you override default list styles, bullets may not contrast well on all container backgrounds.
  3. Icons not rendering: If Font Awesome fails to load, you'll see empty squares or nothing where icons should be.
  4. Overflow edge cases: The script catches most overflow, but complex nested layouts occasionally slip through.
  5. Unexpected text wrap: Text that you expected to fit on one line actually overflows to two lines. This is especially common in column layouts, where the header of one column may wrap while the rest don't, making things uneven.
Re-capture specific slides after fixes:
bash
npx decktape reveal "presentation.html?export" output.pdf \
  --screenshots \
  --screenshots-directory "screenshots/$(date +%Y%m%d_%H%M%S)" \
  --slides 2,5,7-9
Then re-examine the updated screenshots to verify fixes. The new timestamped folder makes it easy to compare with the previous version.
溢出脚本能发现大多数布局问题,但这些问题需要视觉检查:
  1. 容器中的颜色继承:盒子或提示框内的文本可能从父元素继承错误的颜色。如果页面背景是深色,文本是浅色,那么浅色
    .box
    .callout
    内的文本将不可读,除非你显式为该容器设置深色文本颜色。
    修复模式 - 显式为浅色容器设置文本和项目符号颜色:
    css
    .box-light p,
    .box-light li {
      color: var(--text-dark);
    }
    
    .box-light ul li::before {
      background: var(--primary-color);  /* 项目符号颜色 */
    }
  2. 自定义项目符号/列表样式:如果你覆盖了默认列表样式,项目符号在所有容器背景上可能对比度不足。
  3. 图标未渲染:如果Font Awesome加载失败,图标位置会显示空方块或无内容。
  4. 溢出边缘情况:脚本能发现大多数溢出,但复杂的嵌套布局偶尔会遗漏。
  5. 意外的文本换行:你期望在一行的文本实际上溢出到两行。这在分栏布局中尤其常见,其中一列的标题可能换行,而其他列的标题不换行,导致布局不均匀。
修复后重新捕获特定幻灯片:
bash
npx decktape reveal "presentation.html?export" output.pdf \
  --screenshots \
  --screenshots-directory "screenshots/$(date +%Y%m%d_%H%M%S)" \
  --slides 2,5,7-9
然后重新检查更新后的截图以确认修复。新的带时间戳的文件夹让你可以轻松与之前的版本比较。

Step 7: Finalize Presentation

步骤7:最终确定演示文稿

CRITICAL: After completing your presentation content and custom CSS, you MUST run the finalization script to integrate styles and clean up artifacts.
Run the finalization script:
bash
node <path-to-skill>/scripts/finalize.js deck-{slug}
What the finalization script does:
  1. Creates
    assets/
    folder
    - Standard directory for images, documents, and other assets (also created automatically by
    create-presentation.js
    )
  2. Integrates custom CSS - Finds all
    *.css
    files in the deck root (except
    lib/offline-v2.css
    ) and:
    • Appends their content to
      lib/offline-v2.css
      with clear markers
    • Removes the separate CSS files
    • Removes external CSS
      <link>
      tags from
      index.html
      (keeps only
      lib/offline-v2.css
      )
  3. Cleans build artifacts - Removes temporary files:
    • screenshots/
      directory (from decktape screenshot generation)
    • output.pdf
      (from decktape PDF export)
Why finalization is important:
  • Single CSS file: All styles consolidated in
    lib/offline-v2.css
    for easier distribution
  • Clean HTML: No external CSS references that could break if files are moved
  • Production ready: Removes temporary build artifacts
  • Standard structure: Ensures
    assets/
    folder exists for organizing images/docs
When to run finalization:
  • After completing all slide content
  • After adding any custom CSS files
  • Before sharing or deploying the presentation
  • After generating screenshots/PDFs (to clean up artifacts)
Note: The
assets/
folder is created automatically by
create-presentation.js
, but the finalization script ensures it exists if you're finalizing an older deck.
关键提示:完成演示文稿内容和自定义CSS后,你必须运行最终脚本以集成样式并清理工件。
运行最终脚本:
bash
node <path-to-skill>/scripts/finalize.js deck-{slug}
最终脚本的作用:
  1. 创建
    assets/
    文件夹
    - 用于存放图片、文档和其他资源的标准目录(也会被
    create-presentation.js
    自动创建)
  2. 集成自定义CSS - 查找演示文稿根目录中的所有
    *.css
    文件(除了
    lib/offline-v2.css
    )并:
    • 将它们的内容附加到
      lib/offline-v2.css
      中,并添加清晰的标记
    • 删除单独的CSS文件
    • index.html
      中移除外部CSS的
      <link>
      标签(仅保留
      lib/offline-v2.css
  3. 清理构建工件 - 删除临时文件:
    • screenshots/
      目录(来自decktape截图生成)
    • output.pdf
      (来自decktape PDF导出)
为什么最终确定很重要:
  • 单一CSS文件:所有样式整合到
    lib/offline-v2.css
    中,便于分发
  • 干净的HTML:没有外部CSS引用,避免文件移动后失效
  • 生产就绪:移除临时构建工件
  • 标准结构:确保
    assets/
    文件夹存在,用于组织图片/文档
何时运行最终脚本:
  • 完成所有幻灯片内容后
  • 添加任何自定义CSS文件后
  • 分享或部署演示文稿前
  • 生成截图/PDF后(清理工件)
注意
assets/
文件夹会被
create-presentation.js
自动创建,但最终脚本会确保如果你最终确定的是旧演示文稿,该文件夹也存在。

CSS Components Reference

CSS组件参考

Boxes

盒子

css
.box {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: 8px;
  padding: 20px;
}

.box-outlined {
  border: 1px solid var(--box-border);
  border-radius: 8px;
  padding: 20px;
  background: transparent;
}
css
.box {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: 8px;
  padding: 20px;
}

.box-outlined {
  border: 1px solid var(--box-border);
  border-radius: 8px;
  padding: 20px;
  background: transparent;
}

Callouts

提示框

css
.callout {
  border-left: 6px solid var(--primary-color);
  padding: 15px 20px;
  margin: 15px 0;
  background: #f9f9f9;
  border-radius: 8px;
}

/* Color variants */
.callout-blue { border-left-color: #2196F3; background: #e3f2fd; }
.callout-orange { border-left-color: #ff9800; background: #fff3e0; }
.callout-green { border-left-color: #4caf50; background: #e8f5e9; }
.callout-gray { border-left-color: #666; background: #f5f5f5; }
css
.callout {
  border-left: 6px solid var(--primary-color);
  padding: 15px 20px;
  margin: 15px 0;
  background: #f9f9f9;
  border-radius: 8px;
}

/* 颜色变体 */
.callout-blue { border-left-color: #2196F3; background: #e3f2fd; }
.callout-orange { border-left-color: #ff9800; background: #fff3e0; }
.callout-green { border-left-color: #4caf50; background: #e8f5e9; }
.callout-gray { border-left-color: #666; background: #f5f5f5; }

Blockquotes

引用块

css
.reveal blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 20px;
  margin: 20px 0;
  font-style: italic;
  background: none;
  box-shadow: none;
  width: 100%;
}

.reveal blockquote cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  color: var(--muted-color);
}
css
.reveal blockquote {
  border-left: 4px solid var(--primary-color);
  padding-left: 20px;
  margin: 20px 0;
  font-style: italic;
  background: none;
  box-shadow: none;
  width: 100%;
}

.reveal blockquote cite {
  display: block;
  margin-top: 10px;
  font-style: normal;
  color: var(--muted-color);
}

Icons (Font Awesome)

图标(Font Awesome)

Font Awesome is included in the scaffold. Usage:
html
<i class="fa-solid fa-lightbulb"></i>
<i class="fa-solid fa-check"></i>
<i class="fa-solid fa-gears"></i>
模板中包含Font Awesome。使用方式:
html
<i class="fa-solid fa-lightbulb"></i>
<i class="fa-solid fa-check"></i>
<i class="fa-solid fa-gears"></i>

Template Structure

模板结构

The
template.zip
file contains a complete reveal.js presentation exported from slides.com, including:
  • reveal.js core (
    lib/reveal.js
    ,
    lib/reveal.css
    ) - The presentation framework
  • Plugins (
    lib/reveal-plugins.js
    ):
    • RevealZoom - Zoom into elements (Alt+Click / Ctrl+Click)
    • RevealNotes - Speaker notes view (press S)
    • RevealMarkdown - Markdown support (available but skill prefers HTML markup)
    • RevealHighlight - Code syntax highlighting
  • Fonts (
    lib/fonts/
    ) - Local font files for offline use
  • Styles (
    lib/offline-v2.css
    ) - Complete CSS including themes
  • Offline support (
    lib/offline.js
    ) - Works without internet connection
Note: The template uses slides.com format but we convert it to standard reveal.js
<section>
format when extracting. All plugins are pre-configured and ready to use.
template.zip
文件包含一个完整的reveal.js演示文稿,从slides.com导出,包括:
  • reveal.js核心
    lib/reveal.js
    lib/reveal.css
    )- 演示文稿框架
  • 插件
    lib/reveal-plugins.js
    ):
    • RevealZoom - 放大元素(Alt+点击 / Ctrl+点击)
    • RevealNotes - 演讲者备注视图(按S键)
    • RevealMarkdown - Markdown支持(可用但本技能偏好HTML标记)
    • RevealHighlight - 代码语法高亮
  • 字体
    lib/fonts/
    )- 本地字体文件,支持离线使用
  • 样式
    lib/offline-v2.css
    )- 完整的CSS,包含主题
  • 离线支持
    lib/offline.js
    )- 无需互联网连接即可使用
注意:模板使用slides.com格式,但我们在提取时将其转换为标准reveal.js
<section>
格式。所有插件都已预先配置,可直接使用。

Advanced Features

高级功能

For fragments (progressive reveal), speaker notes, custom backgrounds, auto-animate, and transitions, see references/advanced-features.md.
关于片段(渐进式展示)、演讲者备注、自定义背景、自动动画和过渡效果,请参阅references/advanced-features.md

Reveal.js Configuration

Reveal.js配置

javascript
Reveal.initialize({
  controls: true,          // Show navigation arrows
  progress: true,          // Show progress bar
  slideNumber: true,       // Show slide numbers
  hash: true,              // Update URL hash for each slide
  transition: 'slide',     // none/fade/slide/convex/concave/zoom
  center: false,           // Vertical centering of slide content
  autoSlide: 0,            // Auto-advance (ms), 0 to disable
  loop: false,             // Loop presentation
});
Note on
center
:
Default is
false
(content aligns to top), which works best for content-heavy slides. Set to
true
for minimal/creative presentations where you want content vertically centered.
javascript
Reveal.initialize({
  controls: true,          // 显示导航箭头
  progress: true,          // 显示进度条
  slideNumber: true,       // 显示幻灯片编号
  hash: true,              // 为每张幻灯片更新URL哈希
  transition: 'slide',     // none/fade/slide/convex/concave/zoom
  center: false,           // 幻灯片内容垂直居中
  autoSlide: 0,            // 自动前进(毫秒),0表示禁用
  loop: false,             // 循环演示
});
关于
center
的说明
:默认值为
false
(内容顶部对齐),这在内容较多的幻灯片中效果最佳。对于极简或创意演示文稿,如果你希望内容垂直居中,设置为
true

Built-in Reveal.js Classes

内置Reveal.js类

Use these directly without custom CSS:
  • r-fit-text
    - Auto-size text to fill slide
  • r-stretch
    - Stretch element to fill remaining vertical space
  • r-stack
    - Layer elements on top of each other
html
<h1 class="r-fit-text">BIG TEXT</h1>
<img class="r-stretch" src="image.jpg">
可直接使用这些类,无需自定义CSS:
  • r-fit-text
    - 自动调整文本大小以填充幻灯片
  • r-stretch
    - 拉伸元素以填充剩余垂直空间
  • r-stack
    - 将元素层叠在一起
html
<h1 class="r-fit-text">大文本</h1>
<img class="r-stretch" src="image.jpg">

Adding Charts

添加图表

IMPORTANT: Before adding ANY chart, you MUST read references/charts.md. Charts require specific flexbox/grid patterns to size correctly and avoid overflow. Do not attempt to add charts without reading the full documentation first.
Note: The template does not include Chart.js by default. To add charts, you'll need to include Chart.js and the reveal.js chart plugin. See references/charts.md for details.
Required pattern - charts need flexbox containers and
maintainAspectRatio: false
:
html
<section style="display: flex; flex-direction: column; height: 100%;">
  <h2>Chart Title</h2>
  <div style="flex: 1; position: relative; min-height: 0;">
    <canvas data-chart="bar">
    <!--
    {
      "data": {
        "labels": ["Q1", "Q2", "Q3", "Q4"],
        "datasets": [{ "label": "Revenue", "data": [12, 19, 8, 15] }]
      },
      "options": {
        "maintainAspectRatio": false
      }
    }
    -->
    </canvas>
  </div>
</section>
references/charts.md covers (required reading):
  • Layout patterns: full slide, half (horizontal/vertical), quarter, unequal splits (1fr 2fr, 1fr 3fr)
  • Why the flexbox pattern is required (Chart.js aspect ratio behavior)
  • All chart types (bar, line, pie, doughnut, scatter, etc.)
  • Styling and color options
  • CSV data format (simpler alternative to JSON)
重要提示:在添加任何图表之前,你必须阅读references/charts.md 图表需要特定的flexbox/grid模式才能正确调整大小并避免溢出。在未阅读完整文档之前,不要尝试添加图表。
注意:模板默认不包含Chart.js。要添加图表,你需要包含Chart.js和reveal.js图表插件。详情请参阅references/charts.md
必需模式 - 图表需要flexbox容器和
maintainAspectRatio: false
html
<section style="display: flex; flex-direction: column; height: 100%;">
  <h2>图表标题</h2>
  <div style="flex: 1; position: relative; min-height: 0;">
    <canvas data-chart="bar">
    <!--
    {
      "data": {
        "labels": ["Q1", "Q2", "Q3", "Q4"],
        "datasets": [{ "label": "收入", "data": [12, 19, 8, 15] }]
      },
      "options": {
        "maintainAspectRatio": false
      }
    }
    -->
    </canvas>
  </div>
</section>
references/charts.md涵盖(必读):
  • 布局模式:全屏、半屏(水平/垂直)、四分之一屏、不等分(1fr 2fr、1fr 3fr)
  • 为什么需要flexbox模式(Chart.js的宽高比行为)
  • 所有图表类型(柱状图、折线图、饼图、环形图、散点图等)
  • 样式和颜色选项
  • CSV数据格式(比JSON更简单的替代方案)

Dependencies

依赖项

Required for the scripts:
  • Node.js (for running scripts)
  • adm-zip (for template extraction):
    npm install adm-zip
  • cheerio (for HTML parsing):
    npm install cheerio
  • Puppeteer (for overflow checking):
    npm install puppeteer
  • Decktape (for screenshots):
    npx decktape
    (runs directly)
运行脚本所需的依赖:
  • Node.js(用于运行脚本)
  • adm-zip(用于模板提取):
    npm install adm-zip
  • cheerio(用于HTML解析):
    npm install cheerio
  • Puppeteer(用于溢出检查):
    npm install puppeteer
  • Decktape(用于截图):
    npx decktape
    (直接运行)