charmbracelet/glamour

setting table width ?

pgalbavy-itrs opened this issue · 1 comments

I'm using glamour as the renderer for help text in my program (which is also rendered on web and in PDF by other methods). I want to use tables for typical settings/defaults/description lists instead of layers of bullet points.

I am setting the wordwrap based on the term width (from term.GetSize()) but the table is always rendered as 74 chars wide. e.g.

	var width int
	var err error

	if !term.IsTerminal(int(os.Stdout.Fd())) {
		style = glamour.WithStandardStyle("ascii")
	}
	width, _, err = term.GetSize(int(os.Stdout.Fd()))
	if err != nil {
		width = 80
	}

	tr, err := glamour.NewTermRenderer(
		style,
		glamour.WithStylesFromJSONBytes([]byte(`{ "document": { "margin": 0 } }`)),
		glamour.WithWordWrap(width),
		glamour.WithEmoji(),
	)

Is there a was to filter down the width setting for tables that I have simply missed or is it a restriction in the use of tablewriter?

Hey @pgalbavy-itrs this is fixed in the latest release :)