mdtablefix preserves the line-ending style of the document it formats. It
counts carriage return and line feed (CRLF) (\r\n) and lone line feed (\n)
endings in the input and terminates every output line with whichever style
holds the strict majority. A file authored with Windows line endings therefore
stays CRLF, and a file authored with Unix line endings stays LF; formatting
never converts a consistently ended file to the other style.
When the two styles occur equally often, and when a non-empty input contains no
line ending at all, mdtablefix emits LF. That tie-break is deterministic: it
does not depend on which style appears first.
Detection covers the whole document, including fenced code blocks. A document whose endings are predominantly CRLF is emitted entirely as CRLF, so a code sample authored with LF endings inside such a document is rewritten to CRLF.
Standard input is treated the same way: the style detected on standard input selects the endings written to standard output. Empty standard input still prints a single line ending, as it always has, while an empty file still produces empty output.