Skip to content

Instantly share code, notes, and snippets.

@destroytoday
Created August 30, 2011 05:14
Show Gist options
  • Save destroytoday/1180233 to your computer and use it in GitHub Desktop.
Save destroytoday/1180233 to your computer and use it in GitHub Desktop.
Adds a non-breaking space to the last space of a string, avoiding widows/orphans.
module Jekyll
module Filters
def remarry_widows(input)
newinput = input.gsub(/ ([^ ]+)$/, " \\1")
newinput
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment