Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,3 @@ gem "http_parser.rb", "0.8.0", :platforms => [:jruby]

# plugin dependencies
gem "nokogiri", "1.18.10"
gem "addressable", "2.8.7"
15 changes: 0 additions & 15 deletions _data/plugins/auto_alert.yml

This file was deleted.

37 changes: 37 additions & 0 deletions _plugins/alert.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module Alert
module HtmlExtension
def convert_blockquote(el, indent)
types = %w(note tip important warning caution)
first = el.children.first
return super unless first&.type == :p
return super if first.children.empty?

target = first.children.first
return super unless target&.type == :text

down = target.value.downcase
types.each do |type|
prefix = "[!#{type}]"

# case A: <p>[!NOTE]</p>
if down == prefix
el.attr["data-type"] = type
first.children.shift
break
end

head = prefix + "\n"
next unless down.start_with?(head)

# case B: <p>[!NOTE]\n some text</p>
el.attr["data-type"] = type
target.value = target.value[head.length..-1] || ""
break
end

super
end
end
end

Kramdown::Converter::Html.prepend(Alert::HtmlExtension)
48 changes: 0 additions & 48 deletions _plugins/auto-alert.rb

This file was deleted.

20 changes: 20 additions & 0 deletions _sass/minimal-mistakes-plus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
blockquote {
margin-inline: 0;
font-style: normal;

&[data-type="note"] {
@extend .notice--info;
}

&[data-type="tip"] {
@extend .notice--success;
}

&[data-type="important"] {
@extend .notice--primary;
}

&[data-type="warning"] {
@extend .notice--warning;
}

&[data-type="caution"] {
@extend .notice--danger;
}
}

* {
Expand Down
Loading