Compose offers powerful cross-platform UI development, but lacks a powerful, built-in rich text formatting capabilities. Compose 1.7 introduced support for reading HTML into AnnotatedStrings, but that is only enough for simple runs of formatted text. This leaves developers having to programmatically build more complex AnnotatedStrings, but that is not ideal and it’s pretty much impossible to internationalise.
In the Jewel library we provide a new, powerful API to display Markdown, a common and versatile text format. Markdown is easily created, managed and translated, even allowing you to go beyond what’s achievable with the basic HTML support in Android resources. In fact, Markdown goes beyond inline text styling, and lets you express block-level formatting with facilities like blockquotes, tables, images, and more.
This talk will start by introducing the Jewel library, and then cover all aspects of how we implemented the Jewel Markdown parser. I’ll explain how Markdown is a superior solution compared to HTML for the majority of relevant use cases. We’ll discuss the Markdown specs — or the lack thereof, the various proprietary extensions that exist, and how we’re tackling this challenge. Then, we’ll look at how the library parses the raw Markdown input, and the process that transforms that into a set of Composables on screen. Lastly, the talk will showcase some limitations we’ve run into with the text APIs in Compose, how we’ve worked around some of those, and the impact this work is having on the larger Compose ecosystem.
This talk is aimed at developers who are familiar with Jetpack Compose and/or Compose Multiplatform, and are looking at a way to get rich text rendering, maybe to get rid of a few webviews, or in search of inspiration for their own server-driven UI framework. You’ll not only leave the room with actionable information on those topics but, hopefully, some surprising Markdown facts you didn’t know about!