Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/src/manual/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ julia> lpad(str, 14)
julia> typeof(lpad(str, 7))
Base.AnnotatedString{String}

julia> str2 = Base.AnnotatedString(" julia", [(2:6, :face, :magenta)])
julia> str2 = Base.AnnotatedString(" julia", [(2:6, :datum, 10)])
" julia"

julia> Base.annotatedstring(str, str2)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Markdown/src/Markdown.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module Markdown
import Base: AnnotatedString, AnnotatedIOBuffer, show, ==, with_output_color, mapany
using Base64: stringmime

using StyledStrings: StyledStrings, Face, addface!, @styled_str, styled
using StyledStrings: StyledStrings, Face, addface!, @styled_str, styled, getface
using JuliaSyntaxHighlighting: highlight, highlight!

# Margin for printing in terminal.
Expand Down
12 changes: 6 additions & 6 deletions stdlib/Markdown/src/render/terminal/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function term(io::AnnotIO, md::Header{l}, columns) where l
underline = _header_underlines[l]
pre = ' '^margin
local line_width
with_output_annotations(io, :face => face) do io
with_output_annotations(io, :face => getface(face)) do io
headline = annotprint(terminline, md.text)
lines = wraplines(headline, columns - 4margin)
for (i, line) in enumerate(lines)
Expand All @@ -111,7 +111,7 @@ function term(io::AnnotIO, md::Header{l}, columns) where l
header_width = max(0, line_width)
if underline != ' ' && header_width > 0
print(io, '\n', ' '^(margin))
with_output_annotations(io -> print(io, underline^header_width), io, :face => face)
with_output_annotations(io -> print(io, underline^header_width), io, :face => getface(face))
end
end

Expand Down Expand Up @@ -178,11 +178,11 @@ function terminline(io::IO, md::AbstractString)
end

function terminline(io::AnnotIO, md::Bold)
with_output_annotations(io -> terminline(io, md.text), io, :face => :bold)
with_output_annotations(io -> terminline(io, md.text), io, :face => getface(:bold))
end

function terminline(io::AnnotIO, md::Italic)
with_output_annotations(io -> terminline(io, md.text), io, :face => :italic)
with_output_annotations(io -> terminline(io, md.text), io, :face => getface(:italic))
end

function terminline(io::IO, md::LineBreak)
Expand All @@ -199,9 +199,9 @@ end

function terminline(io::AnnotIO, md::Link)
annots = if occursin(r"^(https?|file)://", md.url)
(:face => :markdown_link, :link => md.url)
(:face => getface(:markdown_link), :link => md.url)
else
(:face => :markdown_link,)
(:face => getface(:markdown_link),)
end
with_output_annotations(io -> terminline(io, md.text), io, annots...)
end
Expand Down