weituotian / md_numbered_headers

sublime text3 plugin for markdown, auto insert/update/remove header numbers
Apache License 2.0
9 stars 1 forks source link

Issue with numbers 10+ as well as potential dot issue #3

Open davmf opened 6 years ago

davmf commented 6 years ago

I find this plugin very useful, but there appears to be an issue with numbers with more than 1 digit.

I suggest an update to your regular expressions as shown below. Note that I also suggest a change with the use of the dot setting which I 'think' is necessary:

pattern_header_num = re.compile(
        r'(#+)\s+((?:\d+' + ('\\.' if dot == '.' else dot) + ')*\d+)' + last_dot + '(.*)')

pattern_header_num_replace = re.compile(
        r'(\d+' + ('\\.' if dot == '.' else dot) + ')*\d+' + last_dot)
weituotian commented 6 years ago

thanks for your great excellent advice ! if you have more free times, please join us in this repository.

this commit had updated the regexs.