Format Table #
This file provides a simple function for formatting a two-dimensional array of Strings
into a markdown-compliant table.
Equations
- instInhabitedAlignment = { default := instInhabitedAlignment.default }
 
Instances For
Equations
- instBEqAlignment = { beq := instBEqAlignment.beq }
 
Equations
- instBEqAlignment.beq x✝ y✝ = (x✝.ctorIdx == y✝.ctorIdx)
 
Instances For
Align a String s to the left, right, or center within a field of width width.
Equations
- s.justify Alignment.left width = String.rightpad width ' ' s
 - s.justify Alignment.right width = String.leftpad width ' ' s
 - s.justify Alignment.center width = String.replicate ((width - s.length) / 2) ' ' ++ s ++ String.replicate (width - s.length - (width - s.length) / 2) ' '
 
Instances For
def
formatTable
(headers : Array String)
(table : Array (Array String))
(alignments : Option (Array Alignment) := none)
 :
Render a two-dimensional array of Strings into a markdown-compliant table.
headers is a list of column headers,
table is a 2D array of cell contents,
alignments describes how to align each table column (default: left-aligned).
Equations
- One or more equations did not get rendered due to their size.