revealjs by ryanbbrown/revealjs-skill
npx skills add https://github.com/ryanbbrown/revealjs-skill --skill revealjs使用 reveal.js 创建 HTML 演示文稿。无需构建步骤 - 直接在浏览器中打开 HTML 文件即可。
一个 reveal.js 演示文稿包含:
关键:在创建任何演示文稿之前,请分析内容并选择合适的设计元素:
要求:
@import 使用 Google Fontspt(点) - 幻灯片是固定大小的,因此 pt 是可预测且熟悉的(如 PowerPoint/Keynote)。字体大小切勿使用 、 或 。广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
emrempx创造性地选择颜色:
示例调色板(使用这些来激发创造力 - 选择一个、调整它或创建你自己的):
多样化的呈现是关键。 即使幻灯片具有相似的内容类型,也要改变视觉呈现:
<strong> 突出关键术语,用不同颜色区分类别保持可扫描性:
当幻灯片内容较少时,将其放大 - 不要留下空白区域和微小的文本。
根据用户的内容,确定:
使用 create-presentation.js 脚本(位于与此 SKILL.md 文件相邻的 scripts/ 目录中)生成 HTML 脚手架。
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,d,3,1,d,1 --title "My Presentation" --output presentation.html
查找脚本路径: 脚本位于 scripts/create-presentation.js,相对于此 SKILL.md 文件的位置。常见位置:
.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 <file> - 输出文件名(默认:presentation.html)--title <text> - 演示文稿标题--styles <file> - 自定义 CSS 文件名(默认:styles.css)示例:
# 10 张水平幻灯片
node <path-to-skill>/scripts/create-presentation.js --slides 10 --output presentation.html
# 混合结构:介绍、2 张内容幻灯片、分隔符、3 张幻灯片垂直堆叠、分隔符、结束语
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,1,d,3,d,1 --title "Q4 Review" --output presentation.html
脚手架脚本会自动将 base-styles.css 复制到你的演示文稿目录,命名为 styles.css。现在为你的演示文稿主题自定义 CSS 变量(尤其是颜色)。
使用 Google Fonts: 在 CSS 文件顶部添加 @import:
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Lato:wght@300;400;600&display=swap');
:root {
--heading-font: "Playfair Display", Georgia, serif;
--body-font: "Lato", Helvetica, sans-serif;
/* ... */
}
基础文件包含:
:root {
/* ===========================================
背景颜色 - 首先设置这个!
=========================================== */
--background-color: #ffffff; /* 深色主题请更改(例如 #1a1a2e) */
/* 排版 - 字体大小始终使用 pt */
--heading-font: "Source Sans Pro", Helvetica, sans-serif;
--body-font: "Source Sans Pro", Helvetica, sans-serif;
--base-font-size: 32px; /* 仅使用 px 值 - 设置 reveal.js 基础值 */
--text-size: 16pt; /* 基础正文文本 - 特意设置得较小 */
--h1-size: 48pt;
--h2-size: 36pt;
--h3-size: 24pt;
/* 颜色 - 为每个演示文稿自定义这些 */
--primary-color: #2196F3;
--secondary-color: #ff9800;
--text-color: #222; /* 深色背景请使用浅色(例如 #FAF7F2) */
--muted-color: #666; /* 深色背景也需调整 */
}
2. 使用 .reveal 前缀覆盖 reveal.js 样式:
.reveal {
font-family: var(--body-font);
}
.reveal h1, .reveal h2, .reveal h3 {
font-family: var(--heading-font);
text-transform: none;
color: var(--text-color);
}
.reveal p, .reveal li {
font-size: var(--text-size);
color: var(--text-color);
}
3. 幻灯片布局样式 - 控制内边距和定位:
.reveal .slides section {
padding: 40px 60px;
text-align: left;
}
4. 文本大小实用工具(当幻灯片内容较少时,使用这些类来放大文本):
/* 基础文本为 16pt - 需要时使用这些类来增加大小 */
.text-lg { font-size: 18pt; } /* 稍大 */
.text-xl { font-size: 20pt; } /* 中等强调 */
.text-2xl { font-size: 24pt; } /* 强强调 */
.text-3xl { font-size: 28pt; } /* 非常大 */
.text-4xl { font-size: 32pt; } /* 最大正文文本 */
.text-muted { color: var(--muted-color); }
.text-center { text-align: center; }
排版指南:
--text-size: 16pt)特意设置得较小,以容纳更多内容.text-lg、.text-xl 等来适当填充空间用于重复模式的自定义 CSS 类:
布局(网格、弹性容器)使用内联样式,因为这些因幻灯片而异。但是,当一种视觉模式出现在多张幻灯片上时,应在 styles.css 中创建一个专用的 CSS 类,而不是重复内联样式。这可以保持 HTML 的整洁并确保一致性。常见示例:统计框(数字 + 标签)、功能卡片(图标 + 标题 + 描述)、时间线/流程步骤、个人资料/简介卡片。如果一个元素重复出现 3 次或以上,它应该是一个类。
重要:使用编辑工具逐步填充幻灯片 — 一次一张或几张幻灯片。不要使用写入工具重写整个 HTML 文件。脚手架为每张幻灯片生成唯一的占位符文本(例如 Slide 2 Title Here),因此每个部分都可以通过编辑工具定位。这比一次性生成整个文件更节省令牌且更不容易出错。
遵循以下模式:
标准幻灯片结构:
<section id="unique-slide-id">
<h2>幻灯片标题</h2>
<div class="content">
<!-- 内容放在这里 -->
</div>
</section>
多列布局 - 始终使用内联 CSS 网格(不要创建像 .grid-2 这样的实用工具类):
<!-- 等宽列 -->
<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"> 中,以确保一致的间距。这是一个弹性盒子容器,填充标题下方剩余的垂直空间,确保内容正确流动。<div class="footnote"> 用于底部的归属或来源文本<p>、<li> 或 <h1>–<h6>)。这些元素从 CSS 继承基础字体大小、颜色和行高。切勿将文本直接放在 <span> 或 <div> 中 — 它们不会拾取基础样式,并且会以错误的大小渲染。仅将 <div> 用作布局容器(用于网格、弹性盒子等),实际文本应放在其中的 <p> 元素内。运行溢出检查器,确保没有幻灯片的内容超出边界:
node scripts/check-overflow.js presentation.html
该脚本检查每张幻灯片的:
如果检测到溢出,请减少受影响幻灯片的内容或调整字体大小。
关键:你必须审查每一张幻灯片的截图。 不要跳过幻灯片或仅审查样本。视觉问题很常见,只能通过单独检查每张幻灯片来发现。
捕获所有幻灯片的截图:
cd <presentation-directory>
npx decktape reveal "presentation.html?export" output.pdf \
--screenshots \
--screenshots-directory "screenshots/$(date +%Y%m%d_%H%M%S)"
注意: ?export 查询参数会禁用图表动画,以获得更清晰的 PDF 渲染。在浏览器中直接查看 HTML 时,图表仍会动画显示。
这将创建一个带时间戳的文件夹(例如 screenshots/20241210_143052/),以便你可以跟踪版本并比较修复前后的情况。
然后使用读取工具检查每个截图图像文件。
溢出脚本可以捕获大多数布局问题,但以下问题需要视觉检查:
容器中的颜色继承:样式化容器内的文本可能会从父元素继承错误的颜色。如果你在深色页面背景上有浅色文本,那么浅色容器内的文本将不可读,除非你明确为该容器设置深色文本颜色。
自定义项目符号/列表样式:如果你覆盖了默认列表样式,项目符号可能无法在所有容器背景上形成良好对比。
图标未渲染:如果 Font Awesome 加载失败,你会在图标应该出现的地方看到空方块或什么都没有。
溢出边缘情况:脚本可以捕获大多数溢出,但复杂的嵌套布局偶尔会漏掉。
意外的文本换行:你期望在一行上显示的文本实际上换行到两行。这在列布局中尤其常见,其中一列的标题可能会换行,而其他列则不会,导致布局不均匀。
修复后重新捕获特定幻灯片:
npx decktape reveal "presentation.html?export" output.pdf \
--screenshots \
--screenshots-directory "screenshots/$(date +%Y%m%d_%H%M%S)" \
--slides 2,5,7-9
然后重新检查更新后的截图以验证修复。新的带时间戳文件夹便于与先前版本进行比较。
完成演示文稿后,告知用户他们可以使用附带的编辑器脚本直接在浏览器中编辑文本:
node <path-to-skill>/scripts/edit-html.js <presentation-directory>/presentation.html
这将在本地服务器中打开演示文稿,他们可以单击任何文本进行内联编辑,然后将更改保存回文件。这对于文字润色、修复拼写错误或调整副本非常有用,而无需编辑原始 HTML。
始终在演示文稿结束时提及此建议,例如:
要微调措辞,你可以直接在浏览器中编辑文本:
node <resolved-path>/scripts/edit-html.js <presentation-directory>/presentation.html单击任何文本进行编辑,按 Escape 取消选择,然后单击保存。完成后按 Ctrl+C 停止服务器。
.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);
}
脚手架中包含了 Font Awesome。用法:
<i class="fa-solid fa-lightbulb"></i>
<i class="fa-solid fa-check"></i>
<i class="fa-solid fa-gears"></i>
关于片段(渐进式显示)、演讲者备注、自定义背景、自动动画和过渡效果,请参阅 references/advanced-features.md。
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。
直接使用这些类,无需自定义 CSS:
r-fit-text - 自动调整文本大小以填充幻灯片
r-stretch - 拉伸元素以填充剩余的垂直空间
r-stack - 将元素层叠在一起
重要:在添加任何图表之前,你必须阅读 references/charts.md。 图表需要特定的弹性盒子/网格模式才能正确调整大小并避免溢出。请勿在未阅读完整文档的情况下尝试添加图表。
脚手架包含了 Chart.js 插件,用于向幻灯片添加条形图、折线图、饼图、环形图和散点图。
必需模式 - 图表需要弹性盒子容器和 maintainAspectRatio: false:
<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": "Revenue", "data": [12, 19, 8, 15] }]
},
"options": {
"maintainAspectRatio": false
}
}
-->
</canvas>
</div>
</section>
references/charts.md 涵盖内容(必读):
脚本所需,应该已经安装:
npm install puppeteernpx decktape(直接运行)每周安装次数
192
仓库
GitHub 星标数
239
首次出现
2026年1月26日
安全审计
安装于
gemini-cli184
opencode184
codex183
github-copilot178
kimi-cli169
cursor166
Create HTML presentations using reveal.js. No build step required - just open the HTML in a browser.
A reveal.js presentation consists of:
CRITICAL : Before creating any presentation, analyze the content and choose appropriate design elements:
Requirements :
@import in CSSpt (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.Choosing colors creatively :
Example color palettes (use these to spark creativity - choose one, adapt it, or create your own):
Diverse presentation is key. Even when slides have similar content types, vary the visual presentation:
<strong> for key terms, different colors to distinguish categoriesKeep it scannable:
When a slide has less content, make it bigger - don't leave empty space with tiny text.
Based on the user's content, determine:
Use the create-presentation.js script (located in the scripts/ directory next to this SKILL.md file) to generate the HTML scaffold.
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,d,3,1,d,1 --title "My Presentation" --output presentation.html
Finding the script path: The script is at scripts/create-presentation.js relative to where this SKILL.md file is located. Common locations:
.claude/skills/revealjs/scripts/create-presentation.js~/.claude/skills/revealjs/scripts/create-presentation.jsOptions:
--slides N - Create N horizontal slides (simple mode)--structure <list> - Mixed layout with comma-separated values:
1 = single horizontal slideN (where N > 1) = vertical stack of N slidesd = section divider slide (centered, no content wrapper)--output <file> - Output filename (default: presentation.html)--title <text> - Presentation title--styles <file> - Custom CSS filename (default: styles.css)Examples:
# 10 horizontal slides
node <path-to-skill>/scripts/create-presentation.js --slides 10 --output presentation.html
# Mixed structure: intro, 2 content slides, divider, 3-slide vertical stack, divider, closing
node <path-to-skill>/scripts/create-presentation.js --structure 1,1,1,d,3,d,1 --title "Q4 Review" --output presentation.html
The scaffold script automatically copies base-styles.css to your presentation directory as styles.css. Now customize the CSS variables (especially colors) for your presentation theme.
Using Google Fonts: Add an @import at the top of your CSS file:
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=Lato:wght@300;400;600&display=swap');
:root {
--heading-font: "Playfair Display", Georgia, serif;
--body-font: "Lato", Helvetica, sans-serif;
/* ... */
}
The base file includes:
:root {
/* ===========================================
BACKGROUND COLOR - Set this first!
=========================================== */
--background-color: #ffffff; /* Change for dark themes (e.g., #1a1a2e) */
/* Typography - ALWAYS use pt for font sizes */
--heading-font: "Source Sans Pro", Helvetica, sans-serif;
--body-font: "Source Sans Pro", Helvetica, sans-serif;
--base-font-size: 32px; /* Only px value - sets reveal.js base */
--text-size: 16pt; /* Base body text - intentionally small */
--h1-size: 48pt;
--h2-size: 36pt;
--h3-size: 24pt;
/* Colors - customize these for each presentation */
--primary-color: #2196F3;
--secondary-color: #ff9800;
--text-color: #222; /* Use light color (e.g., #FAF7F2) for dark backgrounds */
--muted-color: #666; /* Adjust for dark backgrounds too */
}
2. Override reveal.js styles using .reveal prefix:
.reveal {
font-family: var(--body-font);
}
.reveal h1, .reveal h2, .reveal h3 {
font-family: var(--heading-font);
text-transform: none;
color: var(--text-color);
}
.reveal p, .reveal li {
font-size: var(--text-size);
color: var(--text-color);
}
3. Slide layout styles - control padding and positioning:
.reveal .slides section {
padding: 40px 60px;
text-align: left;
}
4. Text size utilities (use these to scale up text when slides have less content):
/* Base text is 16pt - use these classes to increase size when needed */
.text-lg { font-size: 18pt; } /* Slightly larger */
.text-xl { font-size: 20pt; } /* Medium emphasis */
.text-2xl { font-size: 24pt; } /* Strong emphasis */
.text-3xl { font-size: 28pt; } /* Very large */
.text-4xl { font-size: 32pt; } /* Maximum body text */
.text-muted { color: var(--muted-color); }
.text-center { text-align: center; }
Typography guidance:
--text-size: 16pt) is intentionally small to fit more content.text-lg, .text-xl, etc. to fill space appropriatelyCustom CSS classes for repeated patterns:
Use inline styles for layout (grids, flex containers) since those vary per slide. But when a visual pattern appears on multiple slides, create a dedicated CSS class in styles.css instead of repeating inline styles. This keeps the HTML clean and ensures consistency. Common examples: stat boxes (number + label), feature cards (icon + title + description), timeline/process steps, profile/bio cards. If an element repeats 3+ times, it should be a class.
IMPORTANT: Use the Edit tool to fill in slides incrementally — one or a few slides at a time. Do NOT rewrite the entire HTML file with the Write tool. The scaffold generates unique placeholder text per slide (e.g., Slide 2 Title Here), so each section can be targeted with Edit. This is more token-efficient and less error-prone than generating the full file at once.
Follow these patterns:
Standard slide structure:
<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):
<!-- 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:
<section> should have a unique id attribute for stable identificationclass="section-divider" for centered section title slides<div class="content"> for consistent spacing. This is a flexbox container that fills the remaining vertical space below the title, ensuring content flows properly.<div class="footnote"> for attribution or source text at bottom<p>, <li>, or <h1>–<h6>). These elements inherit the base font-size, color, and line-height from the CSS. Never put text directly in or — they won't pick up the base styles and will render at the wrong size. Use only as a layout container (for grids, flexbox, etc.), with elements inside it for the actual text.Run the overflow checker to ensure no slides have content that extends beyond boundaries:
node scripts/check-overflow.js presentation.html
The script checks each slide for:
If overflow is detected, reduce content or adjust font sizes on affected slides.
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:
cd <presentation-directory>
npx decktape reveal "presentation.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.
The overflow script catches most layout issues, but these problems require visual inspection:
Color inheritance in containers : Text inside styled containers may inherit the wrong color from parent elements. If you have light text on a dark page background, text inside a light-colored container will be unreadable unless you explicitly set dark text color for that container.
Custom bullet/list styling : If you override default list styles, bullets may not contrast well on all container backgrounds.
Icons not rendering : If Font Awesome fails to load, you'll see empty squares or nothing where icons should be.
Overflow edge cases : The script catches most overflow, but complex nested layouts occasionally slip through.
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:
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.
After completing the presentation, let the user know they can edit text directly in the browser using the included editor script:
node <path-to-skill>/scripts/edit-html.js <presentation-directory>/presentation.html
This opens the presentation in a local server where they can click any text to edit it inline, then save changes back to the file. It's useful for wordsmithing, fixing typos, or tweaking copy without needing to edit raw HTML.
Always mention this at the end of a presentation as a suggestion, e.g.:
To fine-tune the wording, you can edit text directly in the browser:
node <resolved-path>/scripts/edit-html.js <presentation-directory>/presentation.htmlClick any text to edit, press Escape to deselect, then click Save. Press Ctrl+C to stop the server when done.
.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);
}
Font Awesome is included in the scaffold. Usage:
<i class="fa-solid fa-lightbulb"></i>
<i class="fa-solid fa-check"></i>
<i class="fa-solid fa-gears"></i>
For fragments (progressive reveal), speaker notes, custom backgrounds, auto-animate, and transitions, see references/advanced-features.md.
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 oncenter: 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.
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
IMPORTANT: Before adding ANY chart, you MUST readreferences/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.
The scaffold includes the Chart.js plugin for adding bar, line, pie, doughnut, and scatter charts to slides.
Required pattern - charts need flexbox containers and maintainAspectRatio: false:
<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):
Required for the scripts, should be already installed:
npm install puppeteernpx decktape (runs directly)Weekly Installs
192
Repository
GitHub Stars
239
First Seen
Jan 26, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
gemini-cli184
opencode184
codex183
github-copilot178
kimi-cli169
cursor166
前端设计技能指南:避免AI垃圾美学,打造独特生产级界面
49,900 周安装
<span><div><div><p>