Skip to content

Commit

Permalink
patch function Markdown.lines(s) (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
huangyxi committed Jul 3, 2024
1 parent c547f1c commit c30b072
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/MarkdownHighlighter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import Markdown
import .OhMyREPL.Passes.SyntaxHighlighter.SYNTAX_HIGHLIGHTER_SETTINGS
import .OhMyREPL.HIGHLIGHT_MARKDOWN

split_lines(s::AbstractString) = isdefined(Markdown, :lines) ? Markdown.lines(s) : split(s, '\n')

function Markdown.term(io::IO, md::Markdown.Code, columns)
code = md.code
# Want to remove potential.
Expand Down Expand Up @@ -52,7 +54,7 @@ function Markdown.term(io::IO, md::Markdown.Code, columns)
print(buff, output)

str = String(take!(buff))
lines = Markdown.lines(str)
lines = split_lines(str)
for li in eachindex(lines)
print(io, " "^Markdown.margin, lines[li])
li < lastindex(lines) && println(io)
Expand All @@ -62,7 +64,7 @@ function Markdown.term(io::IO, md::Markdown.Code, columns)
end
else
Base.with_output_color(:cyan, io) do io
lines = Markdown.lines(md.code)
lines = split_lines(md.code)
for i in eachindex(lines)
print(io, " "^Markdown.margin, lines[i])
i < lastindex(lines) && println(io)
Expand Down

0 comments on commit c30b072

Please sign in to comment.