MichaelHatherly / CommonMark.jl

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

fix: early exit while parsing row with unicode chars #63

Closed vdayanand closed 1 year ago

vdayanand commented 1 year ago

may also fix https://github.com/MichaelHatherly/CommonMark.jl/issues/44

MWE

    wstr="""
| Tables   |      Are      |  Cool |
|----------|-------------|------|
| col 1 is |  left-aligned | 1600 |
| col 2 is |    centered   |   12 |
| col 3 is | right-aligned δεδομέ |   1 |
"""
 y = parser(wstr)

Before this PR:

 ┏━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┓
 ┃ Tables   │ Are                     │ Cool ┃
 ┠──────────┼─────────────────────────┼──────┨
 ┃ col 1 is │ left-aligned            │ 1600 ┃
 ┃ col 2 is │ centered                │ 12   ┃
 ┃ col 3 is │ right-aligned δεδομέ  1 │      ┃
 ┗━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┛

After:

 ┏━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━┓
 ┃ Tables   │ Are                  │ Cool ┃
 ┠──────────┼──────────────────────┼──────┨
 ┃ col 1 is │ left-aligned         │ 1600 ┃
 ┃ col 2 is │ centered             │ 12   ┃
 ┃ col 3 is │ right-aligned δεδομέ │ 1    ┃
 ┗━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━┛
MichaelHatherly commented 1 year ago

Thanks @vdayanand! Would you be able to add that MWE as a test so we can avoid regressions in future?

vdayanand commented 1 year ago

Thanks for reviewing. Added a test

MichaelHatherly commented 1 year ago

Will be included in next patch release: https://github.com/JuliaRegistries/General/pull/81601