Skip to content

Commit 8b11407

Browse files
committed
docs(README.md): fix code block formatting and typos, improve readability and clarity of usage examples
The changes in this commit fix the formatting of code blocks in the README.md file, correct some typos, and improve the readability and clarity of the usage examples for the `randomstring` package. This makes it easier for users to understand how to use the package and its various features.
1 parent 5c7c8d6 commit 8b11407

File tree

1 file changed

+38
-30
lines changed

1 file changed

+38
-30
lines changed

README.md

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ This library assists in generating random strings based on specific characterist
1010

1111
## Installation
1212

13-
\```bash
13+
```bash
1414
go get -u github.com/necmettindev/randomstring
15-
\```
15+
```
1616

1717
## Usage
1818

@@ -22,7 +22,7 @@ Below are different scenarios demonstrating how to use the `randomstring` packag
2222

2323
Generate a string of length 10 using the default alphanumeric characters:
2424

25-
\```go
25+
```go
2626
package main
2727

2828
import (
@@ -31,49 +31,57 @@ import (
3131
)
3232

3333
func main() {
34-
result, \_ := randomstring.GenerateString(randomstring.GenerationOptions{Length: 10})
35-
fmt.Println(result)
34+
opts := randomstring.GenerationOptions{
35+
Length: 10,
36+
}
37+
38+
result, _ := randomstring.GenerateStrin(opts)
39+
40+
fmt.Println(result)
3641
}
37-
\```
42+
```
3843

3944
### Disabling Features
4045

4146
For instance, to generate a string containing letters only:
4247

43-
\```go
44-
opts := randomstring.GenerationOptions{
45-
Length: 10,
46-
DisableNumeric: true,
47-
}
48-
result, \_ := randomstring.GenerateString(opts)
49-
fmt.Println(result)
50-
\```
48+
```go
49+
opts := randomstring.GenerationOptions{
50+
Length: 10,
51+
DisableNumeric: true,
52+
}
53+
54+
result, _ := randomstring.GenerateString(opts)
55+
fmt.Println(result)
56+
```
5157

5258
### Using Special Characters
5359

5460
Generate a string with enabled special characters:
5561

56-
\```go
57-
opts := randomstring.GenerationOptions{
58-
Length: 15,
59-
EnableSpecialCharacter: true,
60-
}
61-
result, \_ := randomstring.GenerateString(opts)
62-
fmt.Println(result)
63-
\```
62+
```go
63+
opts := randomstring.GenerationOptions{
64+
Length: 15,
65+
EnableSpecialCharacter: true,
66+
}
67+
68+
result, _ := randomstring.GenerateString(opts)
69+
fmt.Println(result)
70+
```
6471

6572
### Using a Custom Character Set
6673

6774
Generate a string with your own custom character set:
6875

69-
\```go
70-
opts := randomstring.GenerationOptions{
71-
Length: 12,
72-
CustomCharset: "abcXYZ789",
73-
}
74-
result, \_ := randomstring.GenerateString(opts)
75-
fmt.Println(result) // Produces a string consisting only of 'a', 'b', 'c', 'X', 'Y', 'Z', '7', '8', '9'.
76-
\```
76+
```go
77+
opts := randomstring.GenerationOptions{
78+
Length: 12,
79+
CustomCharset: "abcXYZ789",
80+
}
81+
82+
result, _ := randomstring.GenerateString(opts)
83+
fmt.Println(result) // Produces a string consisting only of 'a', 'b', 'c', 'X', 'Y', 'Z', '7', '8', '9'.
84+
```
7785

7886
## Contributing
7987

0 commit comments

Comments
 (0)