Last active
August 29, 2015 14:01
-
-
Save jonjamz/b45f0d8fb049cdecdd42 to your computer and use it in GitHub Desktop.
Replace first-level bullet points with numbered points
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.post = $('textarea').val() | |
var i = 1; | |
window.post = window.post.replace(/(\n)[^\s](\\*)/g, function(str, p1, offset, s) { | |
return '\n' + i++ + '.'; | |
}); | |
$('textarea').val(window.post); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment