Support multi-line text labels by splitting on newlines#301
Merged
thomasp85 merged 3 commits intoposit-dev:mainfrom Apr 13, 2026
Merged
Support multi-line text labels by splitting on newlines#301thomasp85 merged 3 commits intoposit-dev:mainfrom
thomasp85 merged 3 commits intoposit-dev:mainfrom
Conversation
TextRenderer now detects newlines in label values and converts them to arrays of strings for Vega-Lite rendering. Handles both actual newline characters (from database columns, CHAR(10), imported data) and literal \n from SQL string literals. Uses platform-agnostic .lines() method to handle \n, \r\n, and \r. Single-line labels remain unchanged. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Collaborator
|
We also need to do this for titles etc |
Extended newline splitting from text geom labels to all label types: - Chart titles and subtitles - Axis labels (x, y, and all position aesthetics) - Legend titles (color, stroke, and all non-position aesthetics) Created shared split_label_on_newlines() function used by: 1. Chart title/subtitle rendering (mod.rs) 2. Axis label rendering (encoding.rs) 3. Legend title rendering (encoding.rs) 4. Text geom label data (layer.rs TextRenderer) This ensures consistent newline handling across all label contexts. Users can now use \n in any LABEL clause for multi-line text. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.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.
This PR fixes an issue discussed with Thomas off-Github.
Essentially vegalite doesn't process newlines as new lines, but accepts an array of strings instead.
We now split our labels text with newlines into arrays of strings.