org: Disable broken pretty relative links feature
authorNiklas Fasching <niklas.fasching@gmail.com>
Sun, 11 Apr 2021 19:59:26 +0000 (21:59 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 12 Apr 2021 06:08:53 +0000 (08:08 +0200)
go-org PrettyRelativeLinks rewrites relative org links by
- adding `../` in front
- removing any `.org` suffix

This was meant to play well with hugo pretty urls (which pretty much renders
posts in a subdirectory without the file suffix) and allow use of normal org
file links to reference other posts.

There's a lot of edge cases I didn't consider and multiple bug reports in
go-org [1] later I don't think the complexity of handling those edge cases is
worth it - so let's disable it.

[1]
- https://github.com/niklasfasching/go-org/issues/53
- https://github.com/niklasfasching/go-org/commit/5dadf8c4c2924cbb3b93be45f96e1147596ca6f2 (comment)
- https://github.com/niklasfasching/go-org/issues/51

markup/org/convert.go

index 845ee3f3be3ee418eb3b3da591d6feac95e3609b..34043e18d2cf8da88238a950b5d9264c085fd312 100644 (file)
@@ -52,7 +52,6 @@ func (c *orgConverter) Convert(ctx converter.RenderContext) (converter.Result, e
                return afero.ReadFile(c.cfg.ContentFs, filename)
        }
        writer := org.NewHTMLWriter()
-       writer.PrettyRelativeLinks = !c.cfg.Cfg.GetBool("uglyURLs")
        writer.HighlightCodeBlock = func(source, lang string, inline bool) string {
                highlightedSource, err := c.cfg.Highlight(source, lang, "")
                if err != nil {