mirror of
https://github.com/YGGverse/ggemtext.git
synced 2026-03-31 09:05:32 +00:00
update examples
This commit is contained in:
parent
4ce1b20bf7
commit
23b04f26ec
1 changed files with 18 additions and 8 deletions
26
README.md
26
README.md
|
|
@ -29,7 +29,7 @@ use ggemtext::line::{
|
||||||
link::Link,
|
link::Link,
|
||||||
list::List,
|
list::List,
|
||||||
quote::Quote,
|
quote::Quote,
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**Prepare document**
|
**Prepare document**
|
||||||
|
|
@ -50,7 +50,7 @@ for line in gemtext.lines() {
|
||||||
match Inline::from("```inline```") {
|
match Inline::from("```inline```") {
|
||||||
Some(inline) => assert_eq!(inline.value, "inline"),
|
Some(inline) => assert_eq!(inline.value, "inline"),
|
||||||
None => assert!(false),
|
None => assert!(false),
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
##### Multiline
|
##### Multiline
|
||||||
|
|
@ -67,7 +67,7 @@ match Multiline::begin_from("```alt") {
|
||||||
assert_eq!(multiline.buffer.len(), 3);
|
assert_eq!(multiline.buffer.len(), 3);
|
||||||
}
|
}
|
||||||
None => assert!(false),
|
None => assert!(false),
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Header
|
#### Header
|
||||||
|
|
@ -79,7 +79,7 @@ match Header::from("# H1") {
|
||||||
assert_eq!(h1.value, "H1");
|
assert_eq!(h1.value, "H1");
|
||||||
}
|
}
|
||||||
None => assert!(false),
|
None => assert!(false),
|
||||||
}; // H1, H2, H3
|
} // H1, H2, H3
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Link
|
#### Link
|
||||||
|
|
@ -108,16 +108,26 @@ match Link::from(
|
||||||
assert_eq!(link.uri.to_string(), "gemini://geminiprotocol.net");
|
assert_eq!(link.uri.to_string(), "gemini://geminiprotocol.net");
|
||||||
}
|
}
|
||||||
None => assert!(false),
|
None => assert!(false),
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### List
|
#### List
|
||||||
|
|
||||||
|
##### Struct
|
||||||
|
|
||||||
``` rust
|
``` rust
|
||||||
match List::from("* Item") {
|
match List::parse("* Item") {
|
||||||
Some(list) => assert_eq!(list.value, "Item"),
|
Some(list) => assert_eq!(list.value, "Item"),
|
||||||
None => assert!(false),
|
None => assert!(false),
|
||||||
};
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Trait
|
||||||
|
|
||||||
|
``` rust
|
||||||
|
use ggemtext::line::list::Gemtext;
|
||||||
|
assert_eq!("* Item".as_value(), Some("Item"))
|
||||||
|
assert_eq!("Item".to_source(), "* Item")
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Quote
|
#### Quote
|
||||||
|
|
@ -126,7 +136,7 @@ match List::from("* Item") {
|
||||||
match Quote::from("> Quote") {
|
match Quote::from("> Quote") {
|
||||||
Some(quote) => assert_eq!(quote.value, "Quote"),
|
Some(quote) => assert_eq!(quote.value, "Quote"),
|
||||||
None => assert!(false),
|
None => assert!(false),
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Integrations
|
## Integrations
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue