Skip to content

Instantly share code, notes, and snippets.

@Kronopath
Created August 17, 2020 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kronopath/c8935aa383f427bae7313e881f189a4e to your computer and use it in GitHub Desktop.
Save Kronopath/c8935aa383f427bae7313e881f189a4e to your computer and use it in GitHub Desktop.
Jekyll plugin for correct sentence spacing, see https://kronopath.com/blog/the-correct-way-to-do-sentence-spacing/
def convert_to_sentence_spacing(content)
content.gsub(/([.?!][)"]?) /, '\1 ')
end
Jekyll::Hooks.register :posts, :pre_render do | post |
if post["sentence_spacing"] then
post.content = convert_to_sentence_spacing(post.content)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment