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

Markdown: empty list item breaks terminal display #40080

Closed
fonsp opened this issue Mar 17, 2021 · 0 comments · Fixed by #40122
Closed

Markdown: empty list item breaks terminal display #40080

fonsp opened this issue Mar 17, 2021 · 0 comments · Fixed by #40122

Comments

@fonsp
Copy link
Member

fonsp commented Mar 17, 2021

but the parsing is fine, and HTML display still works.

julia> using Markdown

julia> md"""
       1. hello
       2. world
       """
    1. hello

    2. world

julia> md"""
       1. hello
       2. 
       """
    1. hello

    2. Error showing value of type Markdown.MD:
ERROR: BoundsError: attempt to access 0-element Vector{AbstractString} at index [1]
Stacktrace:
  [1] getindex
    @ ./array.jl:801 [inlined]
  [2] print_wrapped(io::IOContext{Base.TTY}, s::Function; width::Int64, pre::String, i::Int64)
    @ Markdown /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/Markdown/src/render/terminal/formatting.jl:45
  [3] #print_wrapped#166
    @ /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/Markdown/src/render/terminal/formatting.jl:52 [inlined]
  [4] term(io::IOContext{Base.TTY}, md::Markdown.List, columns::Int64)
    @ Markdown /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/Markdown/src/render/terminal/render.jl:73
  [5] term(io::IOContext{Base.TTY}, content::Vector{Any}, cols::Int64)
    @ Markdown /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/Markdown/src/render/terminal/render.jl:13
  [6] term
    @ /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/Markdown/src/render/terminal/render.jl:16 [inlined]
  [7] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, md::Markdown.MD)
    @ Markdown /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/Markdown/src/render/terminal/render.jl:176
  [8] (::REPL.var"#38#39"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:220
  [9] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [10] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:213
 [11] display(d::REPL.REPLDisplay, x::Any)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:225
 [12] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [13] #invokelatest#2
    @ ./essentials.jl:707 [inlined]
 [14] invokelatest
    @ ./essentials.jl:706 [inlined]
 [15] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:247
 [16] (::REPL.var"#40#41"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:231
 [17] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
 [18] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:229
 [19] (::REPL.var"#do_respond#61"{Bool, Bool, REPL.var"#72#82"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:798
 [20] #invokelatest#2
    @ ./essentials.jl:707 [inlined]
 [21] invokelatest
    @ ./essentials.jl:706 [inlined]
 [22] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2441
 [23] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /Users/julia/src/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
 [24] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:406

julia> repr(MIME"text/html"(), ans)
"<div class=\"markdown\"><ol>\n<li><p>hello</p>\n</li>\n<li></li>\n</ol>\n</div>"

Julia 1.6.0-beta1, not a bug on Julia 1.5.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant