Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Markdown print error in 1.12.0-DEV #358

Merged
merged 1 commit into from
Jul 3, 2024
Merged
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
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
Loading