Markdown -> Showdown bug in detab regex?

后端 未结 2 1834
深忆病人
深忆病人 2021-01-14 02:09

I\'m looking at Gruber\'s original Markdown implementation here and the Showdown implementation here.

I\'m comparing the _Detab function in each. I\'m

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-14 02:53

    It looks like a bug in the Showdown implementation. Markdown uses 4-space tabs, so a string ending in a tab should always be a multiple of 4 characters long after tabs are converted to spaces. The Perl version makes "Where\t" 8 characters, but the JavaScript one makes it 9 characters.

    I suspect the bug may not occur with tabs at the beginning of a line, which is how they're normally used in Markdown, which would explain why it hasn't been noticed.

提交回复
热议问题