mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 11:15:47 +08:00
e37fb3042d
* Remove checkmark for official plugins * Add author for plugin, which is By Discourse for all discourse and discourse-org github plugins * Link to meta topic instead of github repo * Add experimental flag for plugin metadata and show this as a badge on the plugin list if present --------- Co-authored-by: chapoi <101828855+chapoi@users.noreply.github.com>
48 lines
1.1 KiB
Ruby
48 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
# name: footnote
|
|
# about: Adds markdown.it footnote support to Discourse
|
|
# version: 1.0
|
|
# authors: Discourse Team
|
|
# meta_topic_id: 84533
|
|
# url: https://github.com/discourse/discourse/tree/main/plugins/footnote
|
|
|
|
enabled_site_setting :enable_markdown_footnotes
|
|
|
|
register_asset "vendor/javascripts/markdown-it-footnote.js", :vendored_pretty_text
|
|
|
|
register_asset "stylesheets/footnotes.scss"
|
|
|
|
register_svg_icon "ellipsis-h" if respond_to?(:register_svg_icon)
|
|
|
|
on(:before_post_process_cooked) do |doc, post|
|
|
doc
|
|
.css("a.footnote-backref")
|
|
.each do |backref|
|
|
href = backref["href"] || ""
|
|
id = href[6..-1].to_i
|
|
backref["href"] = "#footnote-ref-#{post.id}-#{id}"
|
|
end
|
|
|
|
doc
|
|
.css("sup.footnote-ref a")
|
|
.each do |ref|
|
|
href = ref["href"] || ""
|
|
id = href[3..-1].to_i
|
|
ref["href"] = "#footnote-#{post.id}-#{id}"
|
|
|
|
id = ref["id"] || ""
|
|
id = id[5..-1].to_i
|
|
ref["id"] = "footnote-ref-#{post.id}-#{id}"
|
|
end
|
|
|
|
doc
|
|
.css("li.footnote-item")
|
|
.each do |li|
|
|
id = li["id"] || ""
|
|
id = id[2..-1].to_i
|
|
|
|
li["id"] = "footnote-#{post.id}-#{id}"
|
|
end
|
|
end
|