Fix R code cells with empty lang option producing invalid class attributes #13659
+24
−1
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.
When rendering R code cells with
lang: "", Quarto would produce invalid class attributes that appeared as literal text in output instead of being parsed correctly.Root Cause
The
block_attr()function insrc/resources/rmd/hooks.Rwas adding a dot prefix to empty string language values, creating invalid attributes like{. .cell-code}(space after period with no language).Empty strings were treated differently from NULL, even though both represent "no language".
Fix
Modified
block_attr()to check both!is.null(lang)ANDnzchar(lang)before adding the dot prefix. Empty strings are now treated the same as NULL (omitted from attributes).Fixes #13656