MichaelHatherly / CommonMark.jl

A CommonMark-compliant Markdown parser for Julia.
Other
84 stars 11 forks source link

Some detailed code issues #60

Open Rratic opened 1 year ago

Rratic commented 1 year ago

The code advance_offset(parser, length(parser.buf) - parser.pos + 1, false) appeared several times. I guess it means to advance to end, but parser.pos does not seem to be the current char number. And this calculation is not needed, so I guess a advance_offset_to_end(parser::Parser, columns::Bool) = advance_offset(parser, typemax(Int), columns) is needed.

Also note that you defined many parser.pos related functions, but they are not always used.

Rratic commented 1 year ago

Add: in the definition of incorporate_line(parser::Parser, ln::AbstractString), in the code elseif parser.pos ≤ length(ln) && !parser.blank, parser.pos and length does not match either.

Rratic commented 1 year ago

It isn't satisfying that none of the above solves https://github.com/MichaelHatherly/CommonMark.jl/pull/57

Add: write_markdown(::TableHeader, w, node, enter) the if block is empty. Did you forget to write something? This can't make the code look nice.

MichaelHatherly commented 1 year ago

Thanks for finding those @Rratic, feel free to open PRs if you feel comfortable addressing them, otherwise I'll have a look at them we I next have some free time.