Skip to content

Commit 9f29260

Browse files
Lilith HafnerLilith Hafner
authored andcommitted
fix implementation
1 parent 220bb5d commit 9f29260

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/stylemacro.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ macro styled_str(raw_content::String)
109109
end =#
110110

111111
# Instead we'll just use a `NamedTuple`
112-
state = let content = unescape_string(raw_content, ('{', '}', ':', '$', '\n'))
112+
state = let content = unescape_string(raw_content, ('{', '}', ':', '$', '\n', '\r'))
113113
(; content, bytes = Vector{UInt8}(content),
114114
s = Iterators.Stateful(zip(eachindex(content), content)),
115115
parts = Any[],
@@ -211,8 +211,12 @@ macro styled_str(raw_content::String)
211211
if char in ('{', '}', ':', '$', '\\')
212212
deleteat!(state.bytes, i + state.offset[] - 1)
213213
state.offset[] -= ncodeunits('\\')
214-
elseif char == '\n'
214+
elseif char ('\n', '\r')
215215
skipped = 0
216+
if char == '\r' && last(peek(state.s)) == '\n'
217+
popfirst!(state.s)
218+
skipped += 1
219+
end
216220
while last(peek(state.s)) (' ', '\t')
217221
popfirst!(state.s)
218222
skipped += 1

0 commit comments

Comments
 (0)