From 5ac2a80dbedd5b3c40da7ce961e7c94c21d6e029 Mon Sep 17 00:00:00 2001 From: k4th Date: Fri, 3 Jul 2020 09:33:25 +0200 Subject: [PATCH 1/3] Change Quotes tag to block --- _plugins/quote.rb | 15 +++------------ _sass/2-components/_quotes.sass | 1 - 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/_plugins/quote.rb b/_plugins/quote.rb index d88e2cedc9..b4d6b847b1 100644 --- a/_plugins/quote.rb +++ b/_plugins/quote.rb @@ -1,25 +1,16 @@ module Jekyll - class Quote < Liquid::Tag - - ALLOWED_ATTRIBUTES = %w( - text - ).freeze - - def initialize(_, args, _) - super - @args = OptionParser.parse(args, ALLOWED_ATTRIBUTES) - raise 'Quote: "text" attribute must be provided' if @args[:attributes][:text].nil? - end + class Quote < Liquid::Block def render(context) %{
- #{@args[:attributes][:text].tr('_', ' ')} + #{Kramdown::Document.new(super).to_html}
} end + end end diff --git a/_sass/2-components/_quotes.sass b/_sass/2-components/_quotes.sass index 4a7a63ff05..3f283ac84d 100644 --- a/_sass/2-components/_quotes.sass +++ b/_sass/2-components/_quotes.sass @@ -19,7 +19,6 @@ &__text border: 1px solid #dddddd position: relative - padding: 1em font-size: 1.6rem line-height: 1.3 From c079142db227ad41543982132093ed65c57faf45 Mon Sep 17 00:00:00 2001 From: k4th Date: Fri, 3 Jul 2020 12:55:45 +0200 Subject: [PATCH 2/3] Override blockquote markdown --- _plugins/custom_blockquote.rb | 7 +++++++ _plugins/quote.rb | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 _plugins/custom_blockquote.rb diff --git a/_plugins/custom_blockquote.rb b/_plugins/custom_blockquote.rb new file mode 100644 index 0000000000..9cdaf9aacc --- /dev/null +++ b/_plugins/custom_blockquote.rb @@ -0,0 +1,7 @@ +class Kramdown::Converter::Html + # You can override any function from this page: + # https://kramdown.gettalong.org/rdoc/Kramdown/Converter/Html.html + def convert_blockquote(el, indent) + Jekyll::Quote.render_with_quotes(inner(el, indent)) + end +end diff --git a/_plugins/quote.rb b/_plugins/quote.rb index b4d6b847b1..597d11523f 100644 --- a/_plugins/quote.rb +++ b/_plugins/quote.rb @@ -2,15 +2,18 @@ module Jekyll class Quote < Liquid::Block def render(context) + Jekyll::Quote.render_with_quotes(Kramdown::Document.new(super).to_html) + end + + def self.render_with_quotes(html_element) %{
- #{Kramdown::Document.new(super).to_html} + #{html_element}
} end - end end From 65e9595c67c340f57dfeb1a82a508ea6f2f24797 Mon Sep 17 00:00:00 2001 From: k4th Date: Fri, 3 Jul 2020 13:08:46 +0200 Subject: [PATCH 3/3] Fix quote styles --- _sass/2-components/_quotes.sass | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/_sass/2-components/_quotes.sass b/_sass/2-components/_quotes.sass index 3f283ac84d..8e40f803bc 100644 --- a/_sass/2-components/_quotes.sass +++ b/_sass/2-components/_quotes.sass @@ -19,6 +19,7 @@ &__text border: 1px solid #dddddd position: relative + padding: 1em font-size: 1.6rem line-height: 1.3 @@ -41,3 +42,6 @@ +padding(.3em 0 0 .3em) bottom: -11px right: -1px + + p + margin: 0 \ No newline at end of file