diff options
author | Christian Muehlhaeuser <muesli@gmail.com> | 2019-12-07 19:49:24 +0100 |
---|---|---|
committer | Christian Muehlhaeuser <muesli@gmail.com> | 2019-12-07 19:49:24 +0100 |
commit | c31c06a79319a0b0ded09d6ada3975462e38ea67 (patch) | |
tree | 0d69bda9fb486534e2cef2b30d143e632c1782a6 /main.go | |
parent | 58c97dc8dbfb7d05fdacbf3ef528499be672d350 (diff) |
Calculate block width from BlockStack & RenderContext
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -110,18 +110,19 @@ func execute(cmd *cobra.Command, args []string) error { !cmd.Flags().Changed("style") { style = "notty" } - r, err := gold.NewTermRenderer(style) - if err != nil { - return err - } - r.WordWrap = int(width) u, err := url.ParseRequestURI(src.URL) if err == nil { u.Path = filepath.Dir(u.Path) - r.BaseURL = u.String() + "/" } + r, err := gold.NewTermRenderer(style, gold.Options{ + BaseURL: u.String() + "/", + WordWrap: int(width), + }) + if err != nil { + return err + } out := r.RenderBytes(b) fmt.Printf("%s", string(out)) return nil |