Skip to content

Commit 511716f

Browse files
authored
[Update] library examples
1 parent fdcfc50 commit 511716f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,24 @@ cargo add codesnap
109109
Use `CodeSnap` builder to generate code snapshot:
110110

111111
```rust
112-
CodeSnap::default()
113-
.code("fn main() { println!(\"Hello, world!\"); }")
114-
.watermark(WatermarkBuilder::default().content("CodeSnap").build()?)
115-
.build()?
116-
.create_snapshot()?.raw_data()?.copy()?;
112+
let code_content = Content::Code(
113+
CodeBuilder::default()
114+
.content(r#"print "Hello, World!""#)
115+
.language("python")
116+
.build()?,
117+
);
118+
119+
let snapshot = CodeSnap::default()
120+
.content(code_content)
121+
.build()?
122+
.create_snapshot()?;
123+
124+
// Copy the snapshot data to the clipboard
125+
snapshot.raw_data()?.copy()
117126
```
118127

119128
## 🌰 Examples
120-
All examples can be found in [examples](https://github.com/mistricky/CodeSnap/tree/main/examples).
129+
All examples can be found in [examples](https://github.com/mistricky/CodeSnap/tree/main/cli/examples).
121130

122131
![hello](https://github.com/user-attachments/assets/99df51ff-0957-40bd-91d0-facbd46a0bec)
123132

0 commit comments

Comments
 (0)