A ragged table aligned
Input
|Name|Role|
|-|:-:|
|Ada|Engineer|
|Bob|Designer|Output
| Name | Role |
| ---- | :------: |
| Ada | Engineer |
| Bob | Designer |Columns are padded to a consistent width, and the centre-alignment marker is kept.
A Markdown table renders correctly regardless of how ragged its source looks, but the source is far easier to edit when the pipes line up. This pads every cell so columns align in the raw text.
It is most useful after hand-editing a table, where changing a single value leaves the whole grid uneven and every subsequent diff noisier than the change deserves. Alignment markers in the separator row are preserved, and the padding follows them, so a centred column stays centred.
Each example below is executed against this tool by the test suite, so what you see is what the tool actually produces.
Input
|Name|Role|
|-|:-:|
|Ada|Engineer|
|Bob|Designer|Output
| Name | Role |
| ---- | :------: |
| Ada | Engineer |
| Bob | Designer |Columns are padded to a consistent width, and the centre-alignment marker is kept.
The details that decide whether a conversion is correct, and where information can be lost without any error being raised.