Ragged Blocks: Rendering Structured Text with Style
Abstract
Whether it be source code in a programming language, prose in natural language, or otherwise, text is highly structured. Currently, text visualizations are confined either to flat, line-based decorations, which can convey only limited information about textual structure, or nested boxes, which convey structure but often destroy the typographic layout of the underlying text. We hypothesize that the lack of rich styling options limits the kinds of information that are displayed alongside text, wherever it may be displayed. In this paper, we show that it is possible to achieve arbitrarily nested decorations while minimally disturbing the underlying typographic layout. Specifically, we present a layout algorithm that generates ragged blocks, or rocks, which are rectilinear polygons that allow nested text to be compactly rendered even when styled with borders and padding. Our layout algorithm is evaluated on a benchmark suite comprising representative source code files in multiple programming languages. The (ragged block) layouts produced by our algorithm are substantially more compact than the (rectangular block) layouts produced by conventional techniques, when uniformly styling every element in the syntax tree with borders and padding.
- Venue
- UIST 2025
- Volume
- Proceedings of the 38th Annual ACM Symposium on User Interface Software and Technology
- DOI
- 10.1145/3746059.3747751
- https://dl.acm.org/doi/pdf/10.1145/3746059.3747751
- Anthology ID
2025.uist.157
Cite
@inproceedings{cohen-chugh-2025-ragged,
title = {{Ragged Blocks: Rendering Structured Text with Style}},
author = {Sam Cohen and Ravi Chugh},
booktitle = {Proceedings of the 38th Annual ACM Symposium on User Interface Software and Technology},
isbn = {9798400720376},
year = {2025},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
doi = {10.1145/3746059.3747751},
url = {https://doi.org/10.1145/3746059.3747751},
abstract = {Whether it be source code in a programming language, prose in natural language, or otherwise, text is highly structured. Currently, text visualizations are confined either to flat, line-based decorations, which can convey only limited information about textual structure, or nested boxes, which convey structure but often destroy the typographic layout of the underlying text. We hypothesize that the lack of rich styling options limits the kinds of information that are displayed alongside text, wherever it may be displayed. In this paper, we show that it is possible to achieve arbitrarily nested decorations while minimally disturbing the underlying typographic layout. Specifically, we present a layout algorithm that generates ragged blocks, or rocks, which are rectilinear polygons that allow nested text to be compactly rendered even when styled with borders and padding. Our layout algorithm is evaluated on a benchmark suite comprising representative source code files in multiple programming languages. The (ragged block) layouts produced by our algorithm are substantially more compact than the (rectangular block) layouts produced by conventional techniques, when uniformly styling every element in the syntax tree with borders and padding.}
}