Skip to content

Commit 92e1557

Browse files
author
yggverse
committed
update readme
1 parent 96f7d64 commit 92e1557

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

README.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,6 @@ cargo add ggemtext
2020

2121
Line parser, useful for [TextTag](https://docs.gtk.org/gtk4/class.TextTag.html) operations in [TextBuffer](https://docs.gtk.org/gtk4/class.TextBuffer.html) context.
2222

23-
**Connect dependencies**
24-
25-
``` rust
26-
use ggemtext::line::{
27-
code::{Inline, Multiline},
28-
header::{Header, Level},
29-
link::Link,
30-
list::List,
31-
quote::Quote,
32-
}
33-
```
34-
35-
**Prepare document**
36-
3723
Iterate Gemtext lines to continue with [Line](#Line) API:
3824

3925
``` rust
@@ -47,6 +33,7 @@ for line in gemtext.lines() {
4733
##### Inline
4834

4935
``` rust
36+
use ggemtext::line::code::Inline;
5037
match Inline::from("```inline```") {
5138
Some(inline) => assert_eq!(inline.value, "inline"),
5239
None => assert!(false),
@@ -56,6 +43,7 @@ match Inline::from("```inline```") {
5643
##### Multiline
5744

5845
``` rust
46+
use ggemtext::line::code::Multiline;
5947
match Multiline::begin_from("```alt") {
6048
Some(mut multiline) => {
6149
assert!(Multiline::continue_from(&mut multiline, "line 1").is_ok());
@@ -75,6 +63,7 @@ match Multiline::begin_from("```alt") {
7563
**Struct**
7664

7765
``` rust
66+
use ggemtext::line::{Header, header::Level};
7867
match Header::parse("# H1") {
7968
Some(h1) => {
8069
assert_eq!(h1.level as u8, Level::H1 as u8);
@@ -96,6 +85,7 @@ assert_eq!("H1".to_source(&Level::H1), "# H1");
9685
#### Link
9786

9887
``` rust
88+
use ggemtext::line::Link;
9989
match Link::from(
10090
"=> gemini://geminiprotocol.net 1965-01-19 Gemini",
10191
None, // absolute path given, base not wanted
@@ -127,6 +117,7 @@ match Link::from(
127117
**Struct**
128118

129119
``` rust
120+
use ggemtext::line::List;
130121
match List::parse("* Item") {
131122
Some(list) => assert_eq!(list.value, "Item"),
132123
None => assert!(false),
@@ -146,6 +137,7 @@ assert_eq!("Item".to_source(), "* Item")
146137
**Struct**
147138

148139
``` rust
140+
use ggemtext::line::Quote;
149141
match Quote::parse("> Quote") {
150142
Some(quote) => assert_eq!(quote.value, "Quote"),
151143
None => assert!(false),

0 commit comments

Comments
 (0)