Skip to content

Commit

Permalink
Merge pull request #635 from k4th/fix-quotes
Browse files Browse the repository at this point in the history
Fix quotes
  • Loading branch information
k4th authored Jul 3, 2020
2 parents 29e36ca + e282da1 commit 5b36a7d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
7 changes: 7 additions & 0 deletions _plugins/custom_blockquote.rb
Original file line number Diff line number Diff line change
@@ -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
16 changes: 5 additions & 11 deletions _plugins/quote.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
module Jekyll
class Quote < Liquid::Tag
class Quote < Liquid::Block

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?
def render(context)
Jekyll::Quote.render_with_quotes(Kramdown::Document.new(super).to_html)
end

def render(context)
def self.render_with_quotes(html_element)
%{<div class="quote">
<div class="quote__text">
#{@args[:attributes][:text].tr('_', ' ')}
#{html_element}
<i class="quote__icon quote__icon--left fas fa-quote-left"></i>
<i class="quote__icon quote__icon--right fas fa-quote-right"></i>
</div>
Expand Down
3 changes: 3 additions & 0 deletions _sass/2-components/_quotes.sass
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@
+padding(.3em 0 0 .3em)
bottom: -11px
right: -1px

p
margin: 0

0 comments on commit 5b36a7d

Please sign in to comment.