Created
July 29, 2020 09:30
-
-
Save BorisAnthony/d6b8e0291d06bb9d1a5b1bc79d560c99 to your computer and use it in GitHub Desktop.
A little Jekyll plugin to parse ==text== into <mark>text</mark>. With thanks to @ashmaroli on https://talk.jekyllrb.com/t/plugin-help-markdown-in-string-processed-by-plugin-not-being-rendered/4771/2
This file contains hidden or 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
Jekyll::Hooks.register :documents, :pre_render do |doc| | |
# We want to catch all pages, posts, docs in collections | |
doc.content = doc.content.gsub( | |
/\=\=(.*)\=\=/i, | |
'<mark markdown="span">\1</mark>' | |
) | |
# setting the markdown="span" flag tells Kramdown to parse what's between the tags, | |
# otherwise it is ignored. | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment