| Crates.io | snips |
| lib.rs | snips |
| version | 0.0.4 |
| created_at | 2025-07-25 04:32:53.423915+00 |
| updated_at | 2025-07-25 06:57:52.770635+00 |
| description | Keep code snippets in markdown files in sync |
| homepage | |
| repository | https://github.com/cortesi/snips |
| max_upload_size | |
| id | 1767185 |
| size | 60,605 |
Keep your code snippets in sync with your source files. Effortlessly.
snips is a command-line tool that prevents your documentation from becoming
stale. It works by creating a direct link between your source code and your
Markdown files, ensuring your code examples are always up-to-date.
snips uses two simple markers to work its magic:
In your source code, you define a snippet with special comments:
// In examples/example.rs
pub fn example() {
// snips-start: main_feature
println!("This is the code I want in my docs!");
// snips-end: main_feature
}
In your Markdown file, you reference that snippet using an HTML comment:
<!-- snips: examples/example.rs#main_feature -->
```rust
println!("This is the code I want in my docs!");
```
Run snips process, and the tool will inject the source code, automatically
handling indentation and language detection.
<!-- snips: path/to/file.rs -->).snips check command fails if your docs are out of
sync, making it perfect for CI pipelines.Want to contribute? Have ideas or feature requests? Come tell us about it on Discord.
cargo install snips
snips render <FILES>...
snips check <FILES>...
snips diff <FILES>...
snips uses the languages library for
programming language detection. This library provides access to GitHub's
Linguist language specification, ensuring accurate language identification and
CodeMirror mode selection for syntax highlighting in your documentation.