Skip to content

Commit

Permalink
fix fenced code blocks have to have the same level
Browse files Browse the repository at this point in the history
  • Loading branch information
hayd committed Mar 21, 2015
1 parent fc412d4 commit f5874c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions base/markdown/GitHub/GitHub.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,23 @@ function fencedcode(stream::IO, block::MD, config::Config)

# inline code block
if contains(flavor, string(ch) ^ n)
#TODO edge case where this is a string(ch) ^ (n + 1)
seek(stream, start)
return false
end

buffer = IOBuffer()
while !eof(stream)
line_start = position(stream)
if startswith(stream, string(ch) ^ n)
push!(block, Code(flavor, takebuf_string(buffer) |> chomp))
return true
else
write(buffer, readline(stream))
if !startswith(stream, string(ch))
push!(block, Code(flavor, takebuf_string(buffer) |> chomp))
return true
else
seek(stream, line_start)
end
end
write(buffer, readline(stream))
end
seek(stream, start)
return false
Expand Down

0 comments on commit f5874c2

Please sign in to comment.