From 24390bd3ca095fe0dc582580cb3e21603b5b81fa Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 3 Jul 2024 17:23:47 +0800 Subject: [PATCH] patch function Markdown.lines(s) --- src/MarkdownHighlighter.jl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MarkdownHighlighter.jl b/src/MarkdownHighlighter.jl index cb5ffdc..6736bf2 100644 --- a/src/MarkdownHighlighter.jl +++ b/src/MarkdownHighlighter.jl @@ -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. @@ -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) @@ -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)