From 8985a37ac054c37d084a03ad2837208244824877 Mon Sep 17 00:00:00 2001 From: TEC Date: Tue, 22 Oct 2024 23:11:01 +0800 Subject: [PATCH] Fix interpolation edge case dropping annotations It is possible to have types with annotations that should be preserved other than AnnotatedString (such as SubString{AnnotatedString}), and so we should consult with Base._isannotated instead of just checking if the type is an AnnotatedString specifically. --- src/styledmarkup.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styledmarkup.jl b/src/styledmarkup.jl index e1edcd4..a55e0cc 100644 --- a/src/styledmarkup.jl +++ b/src/styledmarkup.jl @@ -260,7 +260,7 @@ function addpart!(state::State, start::Int, expr, stop::Int) push!(state.parts, :(let $str = string($expr) $len = ncodeunits($str) # Used in `annots`. - if $str isa AnnotatedString && !isempty($str) + if Base._isannotated($str) && !isempty($str) AnnotatedString(String($str), vcat($annots, annotations($str))) else if isempty($str)