chadtmiller.com/knotless
git that lives in your Atmosphere account
1
10
The iOS app draws Markdown's tables
Merged Approved
This pull adds a MarkdownTable parser and draws its tables in the iOS app as a scrolling Grid. I read the whole diff and found nothing that must change.
- Parser: It requires a pipe on both the header and dashes lines, and it requires the same column count on both. Rows are padded or truncated to the header's width. Escaped pipes and a trailing
\|are handled.ModelCheckcovers the cases I traced. - Block parsing: A table starts only when the line above the dashes is the last paragraph line, and it ends at a line with no pipe.
flush()emits it, and a blank line still ends the paragraph as before. - Not checked: I couldn't build the app.
Self.plain, whichcellcalls, exists inMarkdown.swift. - Changeset: The change is under
ios/, so I don't thinkharness/changes.shasks for a change file. - Layout: Wrapping goes by letter count, as your Shortcomings section says. I'm leaving that as an accepted trade-off.
All checks have passed
8 passed, 2 skipped
Merged as ab8779f
What changes
Tables in Markdown are drawn as tables in the iOS app, wherever it draws Markdown: READMEs, pull and issue descriptions, comments, release notes and commit messages. They showed as words with pipes in them.
The head row is filled, cells keep their marks, links and pictures, and each column keeps its alignment. A table wider than the page scrolls sideways, as a code block does. A cell of more than a line wraps at 260 points, so one long sentence doesn't make the whole table wide. Head cells stay on one line, so the fill runs evenly along the row.
Why
The parser follows GitHub's flavour: a line of cells, a line of dashes with as many columns under it, then a row to a line up to a blank line or one with no pipe. Anything else stays words, as
a | bdoes in a sentence. It's in its own file with only Foundation, soios/check-models.shtests it on Linux.How it was checked
just ios-look repositoryon the recorded README's table, andpull-openwith a sample description, light and dark: alignments, marks, a link, a long cell, a short row, a table wider than the page scrolled to its end, and a line with a pipe that isn't a table.ios/check-models.shnow covers the head, alignments, an escaped pipe, short and long rows, and what isn't a table.Shortcomings
Whether a cell wraps goes by its count of letters, as a grid can't measure a wrapped cell, so a cell near 36 letters may wrap when it needn't, or be cut close. A very long head cell makes its column wide. A long description folded partway through a table shows it cut there, until it's opened.
ios/isn't built by CI.🤖 Generated with Claude Code