-
-
Save nocodesupplyco/a7cafb2eb67d402175e49185af6f100d to your computer and use it in GitHub Desktop.
Fix Paragraph Runts With Nonbreaking Space
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
// Use or update ".no-runt" as the class that should be used on any element to fix runts within | |
$(".no-runt").each(function() { | |
var wordArray = $(this).text().split(" "); | |
if (wordArray.length > 1) { | |
wordArray[wordArray.length-2] += " " + wordArray[wordArray.length-1]; | |
wordArray.pop(); | |
$(this).html(wordArray.join(" ")); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment