Documentation
¶
Index ¶
- func NewTablePlugin(opts ...option) converter.Plugin
- func WithCellPaddingBehavior(behavior CellPaddingBehavior) option
- func WithHeaderPromotion(promote bool) option
- func WithNewlineBehavior(behavior NewlineBehavior) option
- func WithPresentationTables(convert bool) option
- func WithSkipEmptyRows(skip bool) option
- func WithSpanCellBehavior(behavior SpanCellBehavior) option
- type CellPaddingBehavior
- type NewlineBehavior
- type SpanCellBehavior
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTablePlugin ¶
func WithCellPaddingBehavior ¶
func WithCellPaddingBehavior(behavior CellPaddingBehavior) option
WithCellPaddingBehavior configures how to handle padding in table cells. When set to "aligned" (default), every cell's text is padded to the width of the largest cell in its column. When set to "minimal", every cell gets a space at the beginning and end of the cell for some minimal padding. When set to "none", no extra padding is applied to cells.
func WithHeaderPromotion ¶
func WithHeaderPromotion(promote bool) option
WithHeaderPromotion configures whether the first row should be treated as a header when the table has no explicit header row (e.g. <th> elements). When set to true, the first row will be converted to a header row with separator dashes. When false (default), all rows are treated as regular content.
func WithNewlineBehavior ¶
func WithNewlineBehavior(behavior NewlineBehavior) option
WithNewlineBehavior configures how to handle newlines in table cells. When set to NewlineBehaviorSkip (default), tables with newlines in cells are skipped. When set to NewlineBehaviorPreserve, newlines are preserved in cells.
Markdown tables don't support multiline content by default, so this provides a workaround to still convert tables with newlines.
func WithPresentationTables ¶
func WithPresentationTables(convert bool) option
WithPresentationTables configures whether tables marked with role="presentation" should be converted to markdown. When set to true, presentation tables will be converted like regular tables. When false (default), these tables are skipped since they typically represent layout rather than semantic content.
func WithSkipEmptyRows ¶
func WithSkipEmptyRows(skip bool) option
WithSkipEmptyRows configures the table plugin to omit empty rows from the output. An empty row is defined as a row where all cells contain no content or only whitespace. When set to true, empty rows will be omitted from the output. When false (default), all rows are preserved.
func WithSpanCellBehavior ¶
func WithSpanCellBehavior(behavior SpanCellBehavior) option
WithSpanCellBehavior configures how cells affected by colspan/rowspan attributes should be rendered. When a cell spans multiple columns or rows, the affected cells can either be empty or contain the same content as the original cell.
Types ¶
type CellPaddingBehavior ¶
type CellPaddingBehavior string
const ( // CellPaddingBehaviorAligned adds visual padding to cells to make each column equal width (default). CellPaddingBehaviorAligned CellPaddingBehavior = "aligned" // CellPaddingBehaviorMinimal keeps a very small amount of padding to balance table readability while also reducing character count. CellPaddingBehaviorMinimal CellPaddingBehavior = "minimal" // CellPaddingBehaviorNone refrains from adding the padding to the cells. CellPaddingBehaviorNone CellPaddingBehavior = "none" )
type NewlineBehavior ¶
type NewlineBehavior string
const ( // NewlineBehaviorSkip skips tables with newlines in cells (default). NewlineBehaviorSkip NewlineBehavior = "skip" // NewlineBehaviorPreserve preserves newlines in cells. NewlineBehaviorPreserve NewlineBehavior = "preserve" )
type SpanCellBehavior ¶
type SpanCellBehavior string
const ( // SpanBehaviorEmpty renders an empty cell. SpanBehaviorEmpty SpanCellBehavior = "empty" // SpanBehaviorMirror renders the same content as the original cell. SpanBehaviorMirror SpanCellBehavior = "mirror" )