mirror of
https://github.com/makew0rld/amfora.git
synced 2024-12-04 14:46:29 -05:00
🐛 Fix heading and link styling when color is disabled
This commit is contained in:
parent
5056bd303d
commit
bd6daa5a3c
@ -37,6 +37,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Bottom bar is not in focus after clicking Enter
|
- Bottom bar is not in focus after clicking Enter
|
||||||
- Badly formed links on pages can no longer crash the browser
|
- Badly formed links on pages can no longer crash the browser
|
||||||
- Disabling color in config affects UI elements (#16)
|
- Disabling color in config affects UI elements (#16)
|
||||||
|
- Keep bold for headings even with color disabled
|
||||||
|
- Don't make whole link text bold when color is disabled
|
||||||
|
|
||||||
|
|
||||||
## [1.0.0] - 2020-06-18
|
## [1.0.0] - 2020-06-18
|
||||||
|
@ -29,9 +29,9 @@ func convertRegularGemini(s string, numLinks int, width int) (string, []string)
|
|||||||
for i := range lines {
|
for i := range lines {
|
||||||
lines[i] = strings.TrimRight(lines[i], " \r\t\n")
|
lines[i] = strings.TrimRight(lines[i], " \r\t\n")
|
||||||
|
|
||||||
if strings.HasPrefix(lines[i], "#") && viper.GetBool("a-general.color") {
|
if strings.HasPrefix(lines[i], "#") {
|
||||||
|
|
||||||
// Headings
|
// Headings
|
||||||
|
if viper.GetBool("a-general.color") {
|
||||||
if strings.HasPrefix(lines[i], "###") {
|
if strings.HasPrefix(lines[i], "###") {
|
||||||
lines[i] = "[fuchsia::b]" + lines[i] + "[-::-]"
|
lines[i] = "[fuchsia::b]" + lines[i] + "[-::-]"
|
||||||
}
|
}
|
||||||
@ -41,6 +41,18 @@ func convertRegularGemini(s string, numLinks int, width int) (string, []string)
|
|||||||
if strings.HasPrefix(lines[i], "#") {
|
if strings.HasPrefix(lines[i], "#") {
|
||||||
lines[i] = "[red::b]" + lines[i] + "[-::-]"
|
lines[i] = "[red::b]" + lines[i] + "[-::-]"
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Just bold, no colors
|
||||||
|
if strings.HasPrefix(lines[i], "###") {
|
||||||
|
lines[i] = "[::b]" + lines[i] + "[::-]"
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(lines[i], "##") {
|
||||||
|
lines[i] = "[::b]" + lines[i] + "[::-]"
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(lines[i], "#") {
|
||||||
|
lines[i] = "[::b]" + lines[i] + "[::-]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Links
|
// Links
|
||||||
} else if strings.HasPrefix(lines[i], "=>") && len([]rune(lines[i])) >= 3 {
|
} else if strings.HasPrefix(lines[i], "=>") && len([]rune(lines[i])) >= 3 {
|
||||||
@ -84,8 +96,8 @@ func convertRegularGemini(s string, numLinks int, width int) (string, []string)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// No colours allowed
|
// No colours allowed
|
||||||
lines[i] = `[::b][` + strconv.Itoa(numLinks+len(links)) + "[] " +
|
lines[i] = `[::b][` + strconv.Itoa(numLinks+len(links)) + "[][::-] " +
|
||||||
`["` + strconv.Itoa(numLinks+len(links)-1) + `"]` + linkText + `[""][-]`
|
`["` + strconv.Itoa(numLinks+len(links)-1) + `"]` + linkText + `[""]`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lists
|
// Lists
|
||||||
|
Loading…
Reference in New Issue
Block a user