Skip to content

Commit

Permalink
Fix interpolation edge case dropping annotations
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tecosaur committed Oct 22, 2024
1 parent 729f56c commit 8985a37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/styledmarkup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8985a37

Please sign in to comment.