Created
April 21, 2021 22:46
-
-
Save kinoute/c2db61fa6549f474948a5c3937efde9f to your computer and use it in GitHub Desktop.
Add a wrapper around tables to allow overflow on Jekyll websites
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
.table-wrapper { | |
overflow: auto; | |
padding-top: 10px; | |
padding-bottom: 10px; | |
} |
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
# _plugins/table_wrapper.rb | |
Jekyll::Hooks.register :documents, :post_render do |doc| | |
doc.output.gsub! /<table>/, '<div class="table-wrapper" markdown="block"><table>' | |
doc.output.gsub! /<\/table>/, '</table></div>' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For GitHub pages users, with no support for custom plugins: you can get the same effect using Liquid's
replace
.