Use go-org fork to remove html outline divs and get slug headline ids (#39)

* point go-org dependency to fork

* fix dep commit

* remove outlines from expected test output
This commit is contained in:
Facundo Olano 2024-06-11 14:35:47 -03:00 committed by GitHub
parent 0f8bf76179
commit de5ea63d0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 23 deletions

8
go.mod
View file

@ -6,14 +6,14 @@ require (
github.com/alecthomas/chroma/v2 v2.5.0
github.com/alecthomas/kong v0.8.1
github.com/elliotchance/orderedmap/v2 v2.2.0
github.com/facundoolano/go-org v0.0.0-20240611152452-f50bf800e0ef
github.com/fsnotify/fsnotify v1.7.0
github.com/niklasfasching/go-org v1.7.1-0.20240323173655-fc916744d4ce
github.com/osteele/liquid v1.3.2
github.com/tdewolff/minify/v2 v2.20.16
github.com/yuin/goldmark v1.7.0
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc
golang.org/x/net v0.17.0
golang.org/x/text v0.13.0
golang.org/x/net v0.23.0
golang.org/x/text v0.14.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)
@ -21,6 +21,6 @@ require (
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/osteele/tuesday v1.0.3 // indirect
github.com/tdewolff/parse/v2 v2.7.11 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.18.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

18
go.sum
View file

@ -16,12 +16,14 @@ github.com/dlclark/regexp2 v1.7.0 h1:7lJfhqlPssTb1WQx4yvTHN0uElPEv52sbaECrAQxjAo
github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/elliotchance/orderedmap/v2 v2.2.0 h1:7/2iwO98kYT4XkOjA9mBEIwvi4KpGB4cyHeOFOnj4Vk=
github.com/elliotchance/orderedmap/v2 v2.2.0/go.mod h1:85lZyVbpGaGvHvnKa7Qhx7zncAdBIBq6u56Hb1PRU5Q=
github.com/facundoolano/go-org v0.0.0-20240611144737-3ce894e24f84 h1:j0NIBYy6IyRmZ0be+5bc5Y782H/FCSieDpncaE1Cta0=
github.com/facundoolano/go-org v0.0.0-20240611144737-3ce894e24f84/go.mod h1:a/m9I6domFxcZAxqDOOE5W/YzbANRLP7hlHn4/771nU=
github.com/facundoolano/go-org v0.0.0-20240611152452-f50bf800e0ef h1:p/A+psLOLHo85cNGgcrNYvH3Tic40e7qiHgiqQxO824=
github.com/facundoolano/go-org v0.0.0-20240611152452-f50bf800e0ef/go.mod h1:a/m9I6domFxcZAxqDOOE5W/YzbANRLP7hlHn4/771nU=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/niklasfasching/go-org v1.7.1-0.20240323173655-fc916744d4ce h1:wVBPeL8uFo3StvdeMrlRFWhl8AtwMeHTdEiUw/rFYI8=
github.com/niklasfasching/go-org v1.7.1-0.20240323173655-fc916744d4ce/go.mod h1:BfT9c2NpODuGdRhJHvzLCcBeWemRHqvq9Va+QBIn0Ns=
github.com/osteele/liquid v1.3.2 h1:G+MvVYt1HX2xuv99JgdrhV7zRVdlvFnNi8M5rN8gQmI=
github.com/osteele/liquid v1.3.2/go.mod h1:VmzQQHa5v4E0GvGzqccfAfLgMwRk2V+s1QbxYx9dGak=
github.com/osteele/tuesday v1.0.3 h1:SrCmo6sWwSgnvs1bivmXLvD7Ko9+aJvvkmDjB5G4FTU=
@ -44,12 +46,12 @@ github.com/yuin/goldmark v1.7.0 h1:EfOIvIMZIzHdB/R/zVrikYLPPwJlfMcNczJFMs1m6sA=
github.com/yuin/goldmark v1.7.0/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc h1:+IAOyRda+RLrxa1WC7umKOZRsGq4QrFFMYApOeHzQwQ=
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc/go.mod h1:ovIvrum6DQJA4QsJSovrkC4saKHQVs7TvcaeO8AIl5I=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=

View file

@ -14,7 +14,7 @@ import (
"github.com/alecthomas/chroma/v2/lexers"
"github.com/alecthomas/chroma/v2/styles"
"github.com/niklasfasching/go-org/org"
"github.com/facundoolano/go-org/org"
"github.com/osteele/liquid"
"github.com/yuin/goldmark"
gm_highlight "github.com/yuin/goldmark-highlighting/v2"

View file

@ -134,24 +134,16 @@ tags: ["software", "web"]
content, err := templ.Render()
assertEqual(t, err, nil)
expected := `<div id="outline-container-headline-1" class="outline-1">
<h1 id="headline-1">
expected := `<h1 id="my-title">
My title
</h1>
<div id="outline-text-headline-1" class="outline-text-1">
<div id="outline-container-headline-2" class="outline-2">
<h2 id="headline-2">
<h2 id="my-subtitle">
my Subtitle
</h2>
<div id="outline-text-headline-2" class="outline-text-2">
<ul>
<li>list 1</li>
<li>list 2</li>
</ul>
</div>
</div>
</div>
</div>
`
assertEqual(t, string(content), expected)
}