repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
aa8502f
parent
ecec1f4
author
Eric Bower
date
2023-09-14 13:28:40 +0000 UTC
feat: anchor links for prose

design: preserve header `font-size` when there's a `<code />` child
10 files changed,  +92, -0
M go.mod
M go.sum
M feeds/public/main.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;
M go.mod
+1, -0
1@@ -29,6 +29,7 @@ require (
2 	github.com/yuin/goldmark v1.5.3
3 	github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594
4 	github.com/yuin/goldmark-meta v1.1.0
5+	go.abhg.dev/goldmark/anchor v0.1.1
6 	go.uber.org/zap v1.24.0
7 	golang.org/x/crypto v0.6.0
8 	golang.org/x/exp v0.0.0-20221211140036-ad323defaf05
M go.sum
+2, -0
1@@ -269,6 +269,8 @@ github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUei
2 github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
3 github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
4 github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
5+go.abhg.dev/goldmark/anchor v0.1.1 h1:NUH3hAzhfeymRqZKOkSoFReZlEAmfXBZlbXEzpD2Qgc=
6+go.abhg.dev/goldmark/anchor v0.1.1/go.mod h1:zYKiaHXTdugwVJRZqInVdmNGQRM3ZRJ6AGBC7xP7its=
7 go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
8 go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
9 go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
M imgs/public/main.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;
M lists/public/main.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;
M pastes/public/main.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;
M pgs/public/main.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;
M prose/public/main.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;
M shared/mdparser.go
+5, -0
 1@@ -18,6 +18,7 @@ import (
 2 	"github.com/yuin/goldmark/renderer"
 3 	ghtml "github.com/yuin/goldmark/renderer/html"
 4 	"github.com/yuin/goldmark/util"
 5+	"go.abhg.dev/goldmark/anchor"
 6 	yaml "gopkg.in/yaml.v2"
 7 )
 8 
 9@@ -224,6 +225,10 @@ func ParseText(text string, linkify Linkify) (*ParsedText, error) {
10 			extension.Footnote,
11 			meta.Meta,
12 			hili,
13+			&anchor.Extender{
14+				Position: anchor.Before,
15+				Texter:   anchor.Text("#"),
16+			},
17 		),
18 		goldmark.WithParserOptions(
19 			parser.WithAutoHeadingID(),
M smol.css
+12, -0
 1@@ -130,6 +130,18 @@ h3 {
 2   font-size: inherit;
 3 }
 4 
 5+h1 > code {
 6+  font-size: inherit;
 7+}
 8+
 9+h2 > code {
10+  font-size: inherit;
11+}
12+
13+h3 > code {
14+  font-size: inherit;
15+}
16+
17 hr {
18   color: inherit;
19   border: 0;