Ragged Blocks: Rendering Structured Text with Style Conference: The 38th Annual ACM Symposium on User Interface Software and Technology; September 28-October 1, 2025; Busan, Republic of Korea The 38th Annual ACM Symposium on User Interface Software and Technology (UIST ’25), September 28-October 1,
Sam Cohen, Ravi Chugh · 2025
Read Ragged Blocks: Rendering Structured Text with Style Conference: The 38th Annual ACM Symposium on User Interface Software and Technology; September 28-October 1, 2025; Busan, Republic of Korea The 38th Annual ACM Symposium on User Interface Software and Technology (UIST ’25), September 28-October 1, by Sam Cohen, Ravi Chugh (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2507-06460.txt.
Introduction
Sam Cohen and Ravi Chugh show how to dress nested text with borders and pads while the lines keep their shape, in a paper from 2025. Code and prose both nest, yet flat line marks show scant form, and nested boxes wreck the page lay. The team asks whether rich marks can ride on text with near no shift in its lay.
Their lay method draws ragged blocks, bent edge shapes that hug each nested chunk of text. With borders and pads on each node of a parse tree, the ragged lay packs far tighter than box lays in tests on real code files in a range of tongues. The authors argue that freed space lets tools show more form cues next to the text they mark.
Catalog record
| CREATOR | Sam Cohen, Ravi Chugh |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 90 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2507-06460
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Ragged Blocks: Rendering Structured Text with Style Conference: The 38th Annual ACM Symposium on User Interface Software and Technology; September 28-October 1, 2025; Busan, Republic of Korea The 38th Annual ACM Symposium on User Interface Software and Technology (UIST ’25), September 28-October 1, 2025, Busan, Republic of Korea DOI: 10.1145/3746059.3747751 ISBN: 979-8-4007-2037-6/2025/09 CCS: Human-centered computing Graphical user interfaces CCS: Human-centered computing Visualization CCS: Software and its engineering Integrated and visual development environments CCS: Computing methodologies Computer graphics Sam Cohen, Ravi Chugh 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. Figure 1 . A code fragment rendered without nested styling, with nested boxes, with rocks, and with simplified rocks. † † cc-license: by Figure 2 . Factorial, List Comprehension, and Color Picker. Each is shown rendered as rocks, with and without simplification. 1. Introduction Document-rendering GUIs currently do not provide expressive mechanisms for styling and rendering structured text. In rich text editors and word processors, such as Google Docs and Microsoft Word, document authors call attention to parts of their documents using text decorations . These decorations include underlines, italics, foreground and background colors, and inline glyphs, among others. When communicating information back to users, these tools also use such decorations; for example, wavy underlines are commonly used to identify errors and opportunities to make grammar . These decorations are flat : they can appear only within or between lines of text, and are thus inherently limited in their capacity to identify structures of text besides tokens and lines. In traditional code editors and IDEs, such as CodeMirror and VS Code, program authors do not directly apply styles to the source text. But these interfaces typically render programs with syntax highlighting—where tokens are colored based on lexical and “parts-of-speech”–type information—and employ flat decorations, such as wavy underlines and simple glyphs, to identify errors. In contrast to traditional code editors, block-based editors , such as Scratch ( Resnick et al. 2009 ) and Snap! ( Harvey et al. 2013 ) , employ shapes that allow certain code fragments to be “snapped” together via mouse-based direct manipulation. Other structure editors , such as Sandblocks ( Beckmann et al. 2020 ; Beckmann et al. 2023 ) , render rectangular blocks (i.e., boxes) for all syntactic substructures in an otherwise text-based, keyboard-driven editor. Sadly, current text layout algorithms for all of the above systems compromise too much in order to surface structure. They are typically line-based, where visual indications of structure cannot cross the line boundary, or block-based, which often force the underlying text into a layout which does not resemble its source. The “ Boxes Layout” in Figure 1 shows an example deficiency of the latter approach: notice how the nested rectangles, like many GUI elements found in visual programming interfaces, “occupy a great deal of space, making it harder to maintain context” ( Burnett 1999 ) . Furthermore, we hypothesize that layouts which minimize the error with respect to plain-text displays will help facilitate a workflow—described in our prior work on code style sheets ( Cohen and Chugh 2025a ) —where programs and other structured text can be styled and restyled in flexible ways. Ragged Blocks The idea driving this work is to use ragged blocks —abbreviated to rocks —rather than rectangles to render nested substructures of text for rich styling. Analogous to how “ragged right” text is aligned on the left margin but unaligned on the right, a rock is an arbitrary rectilinear polygon, which is “ragged on all sides.” Figure 2 demonstrates three code snippets rendered as ragged blocks: a factorial function written in Haskell, a list comprehension with multiple iterables in Python, and an error message component in TypeScript. The top row of this figure shows compact rock layouts, where rocks for different substructures have sometimes highly irregular boundaries in order to tightly fit the text contained within. Once tight-fitting rock layouts have been computed, it is possible to derive simplified rock layouts (the second row of Figure 2 ), where some corners have been removed (i.e., some edges have been straightened) without further affecting the position of laid-out elements. Although our primary motivation is text, the notion of ragged-block layout is agnostic to the contents of individual elements. For example, Figure 2 shows a color-picking GUI compactly embedded within the surrounding program text. Projectional editors , such as Hazel ( Omar et al. 2021 ) and MPS ( JetBrains 2024 ) , enrich code editors with GUIs in this way, but—like block-based and structure editors—these systems do not render nested blocks as compactly as shown in Figure 2 . Contributions The primary contribution of this paper is a family of layout algorithms that compactly render highly structured text documents as nested ragged blocks. The key challenge is the presence of newlines in the source text. Whereas conventional nested-box layout algorithms limit the visual effect of a newline to the box containing it, a ragged-block layout algorithm must visually reconcile arbitrarily large subtrees separated by a newline. We formulate a data structure, called a region , that reifies the layered steps in our layout algorithm in a way that allows cross-line visual constraints to be permeated and reconciled efficiently. We evaluate our principal layout algorithm on a benchmark suite comprising 7.6k lines of code written in Haskell, Python, and TypeScript, by comparing the deviation of rock- and conventional nested-box layouts to unstyled text. For this evaluation, we uniformly render all substructures in the syntax tree with border and padding; these “blocks-everywhere” visualizations serve as a stress test for nested text layout. Outline The rest of this paper is organized is follows. In § 2 , we discuss related work with a focus on program visualization since it is a particularly rich source of examples for structured text layout. In § 3 , we motivate and present the region data structure, which underlies our family of ragged block layout algorithms. We describe the simplest version of our layout algorithm, called {\textsc{L1}}_{\text{P}} , in detail. The label “P” indicates the use of pure regions in this algorithm. The next section presents several extensions to the base algorithm, {\textsc{L1}}_{\text{P}} . In § 4.1 and