Skip to content

Commit

Permalink
Merge pull request #372 from asinghvi17/as/jldoctest_without_repl
Browse files Browse the repository at this point in the history
Fix `jldoctest` blocks without `julia>` not getting rendered
  • Loading branch information
Moelf authored Nov 19, 2024
2 parents 6cd408c + a9837a5 commit 1e17c65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/MarkdownHighlighter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function Markdown.term(io::IO, md::Markdown.Code, columns)
outputs = String[]
sourcecodes = String[]
do_syntax = false
if occursin(r"jldoctest;?", lang) || lang == "julia-repl"
if (occursin(r"jldoctest;?", lang) && contains(code, "julia> ")) || lang == "julia-repl"
do_syntax = true
code_blocks = split("\n" * code, "\njulia> ")
for codeblock in code_blocks[2:end] #
Expand All @@ -31,7 +31,7 @@ function Markdown.term(io::IO, md::Markdown.Code, columns)
push!(sourcecodes, string(sourcecode))
push!(outputs, string(output))
end
elseif lang == "julia" || lang == ""
elseif lang == "julia" || lang == "" || occursin(r"jldoctest;?", lang)
do_syntax = true
push!(sourcecodes, code)
push!(outputs, "")
Expand Down

0 comments on commit 1e17c65

Please sign in to comment.