用 silicon 生成代码截图
把源码文件渲染成语法高亮图片,用于文档或幻灯片。
运行 silicon main.rs -o out.png,输出渲染后的代码图片。
01命令
命令
$ silicon main.rs -o out.png02作用说明
silicon 用 syntect 高亮文件,并可选添加窗口装饰、阴影、行号和主题,生成适合博客和演示的图片。也能从标准输入读取并输出到剪贴板。
03风险
!注意: 渲染需要字体包含所用字形;字体缺失会导致输出变形。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- Homebrew formula: silicon依据: Create beautiful image of your source code. Packages silicon, a tool that renders source code into syntax-highlighted images.
- Official project documentation依据: Packages silicon, a tool that renders source code into syntax-highlighted images.
最后验证: 2026-09-22 · 分类: 媒体