commit
message
Better styles and line numbers
author
Ben Vogt <[email protected]>
date
2023-04-03 18:01:31
stats
2 file(s) changed,
7 insertions(+),
1 deletions(-)
files
main.go
styles.css
1diff --git a/main.go b/main.go
2index 7c4e9a4..1b5cb2b 100644
3--- a/main.go
4+++ b/main.go
5@@ -51,7 +51,7 @@ type TrackedFile struct {
6 }
7
8 func (f *TrackedFile) SaveTemplate(t *template.Template) {
9- lexer := lexers.Match(f.Destination)
10+ lexer := lexers.Match(f.DestinationDir)
11 if lexer == nil {
12 lexer = lexers.Fallback
13 }
14@@ -65,7 +65,11 @@ func (f *TrackedFile) SaveTemplate(t *template.Template) {
15 checkErr(err)
16 fileStr := string(fileBytes)
17 iterator, err := lexer.Tokenise(nil, fileStr)
18- formatter := html.New(html.WithClasses(true))
19+ formatter := html.New(
20+ html.WithClasses(true),
21+ html.WithLineNumbers(true),
22+ html.LinkableLineNumbers(true, ""),
23+ )
24 s := ""
25 buf := bytes.NewBufferString(s)
26 err = formatter.Format(buf, style, iterator)
27diff --git a/styles.css b/styles.css
28index 20d7994..2cfa342 100644
29--- a/styles.css
30+++ b/styles.css
31@@ -13,6 +13,7 @@
32 --font-size: 13px;
33 --font-family: var(--sans-font);
34 /* Dark/light theme variables. */
35+ --bg: white;
36 --text-color: black;
37 --second-text-color: #838181;
38 --link-color: var(--blue);