Add draggable table column resizing - #451
Conversation
|
Thanks for this — a lot of careful work, and the non-persistence parts are well done: the token-gated My main concern with this PR is the persistence model, not the feature. The path-keyed How would you feel about persisting column widths in the document itself, using the table's delimiter row? A pipe table's delimiter dashes are ignored by the renderer (only colons matter), so we could co-opt dash count as a proportional width: → apply I confirmed our renderer cooperates: against our pinned hoedown 3.0.7, dash count above the minimum has zero effect on output ( You'd keep essentially all the front end — handles, CSS, bridge, colgroup logic; only the persistence half changes. Happy to take that piece on myself if you'd rather not redo it. (Separately: the baseline #432 regression is handled in #440, so this PR can focus purely on resizing.) Generated by Claude Code |
|
Putting the formatting in the document would make it incompatible with prior versions of macdown and just about every other markdown editor out there. A local store of this data in a user folder could suffice, or if they didn't want that, to just resize as needed each time it's opened. The former would be preferred though. |
I like the idea behind this feature and I agree that it should be persistent. I didn't realize just what a pain it was to have the fixed column widths. What do you mean when you say "incompatible with prior versions of macdown and just about every other markdown editor out there"? Aside from doing a quick spike in Hoedown to make sure that the idea would work, I only did a cursory search but I am unaware of any Markdown parsers that care how many dashes are present in that row. If I'm missing something, please let me know! Even beyond my vague concerns about long term maintenance burden, I'd love it if we could find a solution that doesn't break if a user copies the file to a different computer, or potentially, a different folder on the same computer. |
|
Yeah, it's a good idea. I'm not sure if I should build in the things like alignment/justification as the Github Flavored Markdown spec allows. I'd personally say 'yes', with an option in the Settings dialog to allow/disallow it, but that might turn into biting off a lot more than would be appropriate. |
|
@aseelye I'm happy to take over where you've left off -- I certainly don't want to hand you a bunch of extra work you didn't originally sign up for, just because I had a different idea of where this ought to slot in architecturally. You've gotten the ball rolling, and I'm happy to get this extremely valuable feature to a place where I'd be glad to merge it. Please let me know whether you'd prefer that or to finish it yourself? |
|
To the contrary, please do. I'm sure whatever you patch it would fit more cleanly. FWIW I did like the idea of jclark's to insert the additional hyphens instead of a local datastore of file settings, will be more portable and better for group collabs. Also might want to consider using the github markdown extensions down the road for increased formatting options. |
|
Taking this over per the discussion above — proceeding with the in-document, delimiter-row persistence model. Thanks again @aseelye. I'm keeping your front end essentially intact (the drag handles, Persistence model. Column widths live in the document, encoded as the dash counts of the pipe-table delimiter row ( Behavior / constraints:
Explicitly out of scope (candidate future issue): the GFM alignment/justification toggle — @aseelye raised it and flagged it as possible scope creep; agreed, deferring. The #432 natural-width regression is handled separately in #440, not here. Open items I'll carry into the PR: the exact source-rewrite mechanism (the checkbox-toggle path I named does a whole-document text swap; a targeted, undoable edit may be preferable for selection/undo safety — I'll decide against the actual code), and correct-table targeting when a document holds multiple tables (index/hash mapping between the DOM and the source). Tests that asserted the sidecar behavior are removed or retargeted; the bridge, token-gate, CSS, and export tests are kept. @aseelye's original commit is preserved with authorship intact. |

Adds draggable column resizing for Markdown tables in the live preview, with widths persisted outside the Markdown file in Application Support. Includes renderer and persistence tests.