@@ -49,6 +49,7 @@ import androidx.compose.ui.text.TextLinkStyles
4949import androidx.compose.ui.text.buildAnnotatedString
5050import androidx.compose.ui.text.font.FontFamily
5151import androidx.compose.ui.text.font.FontStyle
52+import androidx.compose.ui.text.font.FontWeight
5253import androidx.compose.ui.text.withLink
5354import androidx.compose.ui.text.withStyle
5455import androidx.compose.ui.text.style.TextDecoration
@@ -209,21 +210,49 @@ private fun buildLinkedText(
209210 append(segment)
210211 }
211212 } else {
212− appendLinkedText(segment, linkColor, context)
213+ appendLinkedText(segment, linkColor, codeBackground, context)
213214 }
214215 }
215216 if (streaming) append(" ▌")
216217}
217218
218219/**
219− * Append [text] to the builder. Single-backtick pairs are rendered as inline code
220− * (monospace, backticks dropped); the remaining prose has each http(s) URL turned
221− * into a clickable link. Triple-backtick fences are already stripped upstream in
222− * [buildLinkedText], so only inline spans reach here.
220+ * Append [text] to the builder. Double-asterisk pairs are rendered bold; within each
221+ * segment, single-backtick pairs are rendered as inline code (monospace, backticks
222+ * dropped), and the remaining prose has each http(s) URL turned into a clickable link.
223+ * Triple-backtick fences are already stripped upstream in [buildLinkedText], so only
224+ * inline spans reach here.
223225 */
224226private fun AnnotatedString.Builder.appendLinkedText(
225227 text: String,
226228 linkColor: Color,
229+ codeBackground: Color,
230+ context: Context,
231+) {
232+ // Bold is the outermost inline layer: split on ** first so a bold span can wrap
233+ // inline code and links inside it. Odd-indexed segments sit between a pair of **
234+ // markers, so they're bold (markers dropped); even segments are ordinary prose.
235+ val segments = text.split("**")
236+ segments.forEachIndexed { index, segment ->
237+ if (index % 2 == 1) {
238+ withStyle(SpanStyle(fontWeight = FontWeight.Bold)) {
239+ appendInlineCode(segment, linkColor, codeBackground, context)
240+ }
241+ } else {
242+ appendInlineCode(segment, linkColor, codeBackground, context)
243+ }
244+ }
245+}
246+
247+/**
248+ * Append [text] to the builder, rendering single-backtick pairs as inline code
249+ * (monospace, backticks dropped) and turning each http(s) URL in the remaining prose
250+ * into a clickable link.
251+ */
252+private fun AnnotatedString.Builder.appendInlineCode(
253+ text: String,
254+ linkColor: Color,
255+ codeBackground: Color,
227256 context: Context,
228257) {
229258 // Odd-indexed segments sit between a pair of single backticks, so they're inline
@@ -231,7 +260,7 @@ private fun AnnotatedString.Builder.appendLinkedText(
231260 val segments = text.split("`")
232261 segments.forEachIndexed { index, segment ->
233262 if (index % 2 == 1) {
234− withStyle(SpanStyle(fontFamily = FontFamily.Monospace)) {
263+ withStyle(SpanStyle(fontFamily = FontFamily.Monospace, background = codeBackground)) {
235264 append(segment)
236265 }
237266 } else {