fix: prevent snake_case corruption#58
Conversation
Instances of simple snake cased terms like a_b, i_am_a_snake were showing up corrupted because they were being mistaken for subscripts.
|
Thanks for the fix, @alisaifee! The two-branch regex approach is the right call and the added tests cover the real cases well. Merging. |
Thank you for the quick turn around! I'm really enjoying using your project - and for whatever reason there is a lot of snake case in the markdown docs I work with so very quickly hit that issue. I was surprised that I managed to find and fix the issue but I think that's a testament to the quality of your code base - bravo! |
|
@alisaifee I'm really glad to hear that you're enjoying |
Problem
Instances of simple snake cased terms like a_b, i_am_a_snake were showing up corrupted because they were being mistaken for subscripts.
Sample document
Solution
Split the regex into two branches:
_{x}with braces always converts_xwithout braces only converts when not followed by a letter or underscoreNOTE technically this problem might also exist for super script, but in normal markdown I can't think of an example where this would happen.
Demo