Skip to content

Commit

Permalink
Add <strikethrough>
Browse files Browse the repository at this point in the history
  • Loading branch information
liamg committed Apr 24, 2024
1 parent 8f385a6 commit cdfbe11
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,4 @@ It's not required to close tags you've opened, though it can make for easier rea
- `<blink>`
- `<reverse>`
- `<hidden>`
- `<strikethrough>`
16 changes: 9 additions & 7 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,22 @@ const (
reverse
hidden
italic
strikethrough
)

var resetAll = "\x1b[0m"
var resetFg = "\x1b[39m"
var resetBg = "\x1b[49m"

var attrMap = map[uint8]string{
bold: "\x1b[1m",
dim: "\x1b[2m",
italic: "\x1b[3m",
underline: "\x1b[4m",
blink: "\x1b[5m",
reverse: "\x1b[7m",
hidden: "\x1b[8m",
bold: "\x1b[1m",
dim: "\x1b[2m",
italic: "\x1b[3m",
underline: "\x1b[4m",
blink: "\x1b[5m",
reverse: "\x1b[7m",
hidden: "\x1b[8m",
strikethrough: "\x1b[9m",
}

func (s *parserState) setFg(esc string) string {
Expand Down
15 changes: 8 additions & 7 deletions tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ var bgTags = map[string]string{
}

var attrTags = map[string]uint8{
"bold": bold,
"dim": dim,
"italic": italic,
"underline": underline,
"blink": blink,
"reverse": reverse,
"hidden": hidden,
"bold": bold,
"dim": dim,
"italic": italic,
"underline": underline,
"blink": blink,
"reverse": reverse,
"hidden": hidden,
"strikethrough": strikethrough,
}

0 comments on commit cdfbe11

Please sign in to comment.