diff --git a/Changelog.md b/Changelog.md index 2e4ca13fd..f76663e88 100644 --- a/Changelog.md +++ b/Changelog.md @@ -46,11 +46,13 @@ Although the chat was never enabled per default and was marked as experimental, * Replace uglifier with terser for JS compression [#8268](https://github.com/diaspora/diaspora/pull/8268) ## Bug fixes +* Ensure the log folder exists [#8287](https://github.com/diaspora/diaspora/pull/8287) ## Features * Add tags to tumblr posts [#8244](https://github.com/diaspora/diaspora/pull/8244) * Add blocks to the archive export [#8263](https://github.com/diaspora/diaspora/pull/8263) * Allow points and dashes in the username [#8266](https://github.com/diaspora/diaspora/pull/8266) +* Add support for footnotes in markdown [#8277](https://github.com/diaspora/diaspora/pull/8277) # 0.7.15.0 diff --git a/Gemfile b/Gemfile index 59739ec97..7ee32646a 100644 --- a/Gemfile +++ b/Gemfile @@ -105,10 +105,11 @@ source "https://gems.diasporafoundation.org" do gem "rails-assets-highlightjs", "9.12.0" gem "rails-assets-markdown-it", "8.4.2" - gem "rails-assets-markdown-it-hashtag", "0.4.0" gem "rails-assets-markdown-it-diaspora-mention", "1.2.0" - gem "rails-assets-markdown-it-sanitizer", "0.4.3" + gem "rails-assets-markdown-it-footnote", "3.0.3" + gem "rails-assets-markdown-it-hashtag", "0.4.0" gem "rails-assets-markdown-it--markdown-it-for-inline", "0.1.1" + gem "rails-assets-markdown-it-sanitizer", "0.4.3" gem "rails-assets-markdown-it-sub", "1.0.0" gem "rails-assets-markdown-it-sup", "1.0.0" diff --git a/Gemfile.lock b/Gemfile.lock index 1bf8afb66..61b7b9ae8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -569,6 +569,7 @@ GEM rails-assets-markdown-it--markdown-it-for-inline (0.1.1) rails-assets-markdown-it (8.4.2) rails-assets-markdown-it-diaspora-mention (1.2.0) + rails-assets-markdown-it-footnote (3.0.3) rails-assets-markdown-it-hashtag (0.4.0) rails-assets-markdown-it-sanitizer (0.4.3) rails-assets-markdown-it-sub (1.0.0) @@ -888,6 +889,7 @@ DEPENDENCIES rails-assets-markdown-it (= 8.4.2)! rails-assets-markdown-it--markdown-it-for-inline (= 0.1.1)! rails-assets-markdown-it-diaspora-mention (= 1.2.0)! + rails-assets-markdown-it-footnote (= 3.0.3)! rails-assets-markdown-it-hashtag (= 0.4.0)! rails-assets-markdown-it-sanitizer (= 0.4.3)! rails-assets-markdown-it-sub (= 1.0.0)! diff --git a/app/assets/javascripts/app/helpers/text_formatter.js b/app/assets/javascripts/app/helpers/text_formatter.js index 753590664..c9a302fe9 100644 --- a/app/assets/javascripts/app/helpers/text_formatter.js +++ b/app/assets/javascripts/app/helpers/text_formatter.js @@ -16,6 +16,9 @@ typographer: true }); + var footnote = window.markdownitFootnote; + md.use(footnote); + var inlinePlugin = window.markdownitForInline; md.use(inlinePlugin, "utf8_symbols", "text", function (tokens, idx) { tokens[idx].content = tokens[idx].content.replace(/<->/g, "↔") diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 76d020cd7..598aee04c 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -23,6 +23,7 @@ //= require markdown-it //= require markdown-it-diaspora-mention //= require markdown-it-for-inline +//= require markdown-it-footnote //= require markdown-it-hashtag //= require markdown-it-sanitizer //= require markdown-it-sub diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 9c1c281b2..2baf7a44a 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -113,15 +113,6 @@ class PeopleController < ApplicationController end end - def retrieve_remote - if params[:diaspora_handle] - Workers::FetchWebfinger.perform_async(params[:diaspora_handle]) - head :ok - else - head :unprocessable_entity - end - end - private def find_person diff --git a/config/routes.rb b/config/routes.rb index 8eb5c1ad9..532a9555e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -181,10 +181,6 @@ Rails.application.routes.draw do resources :photos, except: %i(new update) get :stream get :hovercard - - collection do - post 'by_handle' => :retrieve_remote, :as => 'person_by_handle' - end end # Note: The contraint for this route's username parameter cannot be removed. diff --git a/lib/diaspora/message_renderer.rb b/lib/diaspora/message_renderer.rb index f40886d97..4f12c85f8 100644 --- a/lib/diaspora/message_renderer.rb +++ b/lib/diaspora/message_renderer.rb @@ -50,7 +50,9 @@ module Diaspora end def strip_markdown - renderer = Redcarpet::Markdown.new Redcarpet::Render::StripDown, options[:markdown_options] + # Footnotes are not supported in text-only outputs (mail, crossposts etc) + stripdown_options = options[:markdown_options].except(:footnotes) + renderer = Redcarpet::Markdown.new Redcarpet::Render::StripDown, stripdown_options @message = renderer.render(message).strip end @@ -105,26 +107,27 @@ module Diaspora end end - DEFAULTS = {mentioned_people: [], - link_all_mentions: false, - disable_hovercards: false, - truncate: false, - append: nil, - append_after_truncate: nil, - squish: false, - escape: true, - escape_tags: false, - markdown_options: { - autolink: true, + DEFAULTS = {mentioned_people: [], + link_all_mentions: false, + disable_hovercards: false, + truncate: false, + append: nil, + append_after_truncate: nil, + squish: false, + escape: true, + escape_tags: false, + markdown_options: { + autolink: true, fenced_code_blocks: true, space_after_headers: true, - strikethrough: true, - tables: true, - no_intra_emphasis: true, + strikethrough: true, + footnotes: true, + tables: true, + no_intra_emphasis: true }, markdown_render_options: { - filter_html: true, - hard_wrap: true, + filter_html: true, + hard_wrap: true, safe_links_only: true }}.freeze diff --git a/log/.gitkeep b/log/.gitkeep new file mode 100644 index 000000000..e69de29bb