Fix issue #432: restore natural table width and horizontal scrolling#440
Open
samqbush wants to merge 1 commit into
Open
Fix issue #432: restore natural table width and horizontal scrolling#440samqbush wants to merge 1 commit into
samqbush wants to merge 1 commit into
Conversation
…rolling
Two CSS regressions caused wide tables to be squeezed to the pane
width with no horizontal scrolling.
Fix A — GitHub-2020.css (default theme):
The 'body table' rule combined 'width: max-content' with 'max-width: 100%',
causing max-width to cancel max-content so the table could never exceed
the pane width and overflow: auto had nothing to scroll.
Replace with:
display: block;
width: max-content;
min-width: 100%; (fill pane; allow growth beyond it)
overflow-x: auto;
Fix B — export.css (all themes, loads last):
'td, th { word-break: break-word }' forced mid-word cell breaks
universally, collapsing column widths across every theme.
Drop word-break, keep overflow-wrap: break-word so cells size to
natural content width while truly unbreakable strings (e.g. long URLs)
still wrap rather than expanding the table infinitely.
Add a 10-column wide-table regression fixture to
MacDownTests/Fixtures/tables.md + tables.html to guard against
re-introducing either regression.
Related to schuyler#432
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Wide Markdown tables are squeezed to the visible pane width with no horizontal scrolling. Old MacDown v0.7.2 rendered wide tables at natural width and allowed horizontal scrolling via WebKit's
NSScrollView.Closes #432
Root Causes (both verified in
main)Cause 1 —
GitHub-2020.cssdefault themebody tablerulewidth: max-contentwas immediately cancelled bymax-width: 100%, clamping the table to the pane width sooverflow: autohad nothing to scroll.Cause 2 —
export.css(loads last, all themes)td, thruleword-break: break-wordforced mid-word cell breaks universally, collapsing column widths across every theme regardless of Cause 1.Changes
MacDown/Resources/Styles/GitHub-2020.cssMacDown/Resources/Extensions/export.cssMacDownTests/Fixtures/tables.md+tables.htmlAdded a 10-column wide-table regression fixture to guard against re-introducing either regression.
Testing
MPMarkdownRenderingTestsandMPHTMLExportTestspass (including the new wide-table fixture).