enhance(md, config, cli): Mark wrapped table rows and truncate headers - #922
Merged
Conversation
Wrapped table cells used to render as several plain rows, so a reader could not tell where one logical row ended and the next began. A continuation line now opens with `┆` instead of `|`, making it clear that it belongs to the row above. This is controlled by the new `style.markdown.table_continuation_edge` config option (default `true`); setting it to `false` restores every line opening with `|`, which keeps the output splitting into the right columns if pasted into a markdown document, since GFM treats a row's leading `|` as optional. Header cells that exceed their column width are now truncated with an `…` marker instead of being word-wrapped. Wrapping a header pushed the separator line down, and a markdown parser reading that output would promote the header's own wrapped tail into the header row. Truncating keeps the separator on the second line. `jp_md::table::TableOptions::continuation_edge` and `jp_md::format::Formatter::table_continuation_edge` expose the new behavior to callers, and `jp_cli`'s chat renderer wires the config value through when building the formatter. Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
Signed-off-by: Jean Mertz <git@jeanmertz.com>
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.
Wrapped table cells used to render as several plain rows, so a reader could not tell where one logical row ended and the next began. A continuation line now opens with
┆instead of|, making it clear that it belongs to the row above. This is controlled by the newstyle.markdown.table_continuation_edgeconfig option (defaulttrue); setting it tofalserestores every line opening with|, which keeps the output splitting into the right columns if pasted into a markdown document, since GFM treats a row's leading|as optional.Header cells that exceed their column width are now truncated with an
…marker instead of being word-wrapped. Wrapping a header pushed the separator line down, and a markdown parser reading that output would promote the header's own wrapped tail into the header row. Truncating keeps the separator on the second line.jp_md::table::TableOptions::continuation_edgeandjp_md::format::Formatter::table_continuation_edgeexpose the new behavior to callers, andjp_cli's chat renderer wires the config value through when building the formatter.