diff --git a/Gemfile b/Gemfile index 196e17dd..52b931bd 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,7 @@ gem 'rails-i18n' gem 'rails_warden' gem 'redis', require: %w[redis redis/connection/hiredis] gem 'redis-rails' +gem 'reverse_markdown', git: 'https://0xacab.org/sutty/reverse_markdown.git' gem 'rubyzip' gem 'rugged' gem 'sidekiq' diff --git a/Gemfile.lock b/Gemfile.lock index 13bfae01..5f30c440 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,10 @@ +GIT + remote: https://0xacab.org/sutty/reverse_markdown.git + revision: 5c243096669aa77e0dc173dec8006b4c5fe07683 + specs: + reverse_markdown (1.2.0) + nokogiri + GEM remote: https://rubygems.org/ specs: @@ -462,6 +469,7 @@ DEPENDENCIES rbnacl (< 5.0) redis redis-rails + reverse_markdown! rubocop-rails rubyzip rugged diff --git a/app/models/metadata_content.rb b/app/models/metadata_content.rb index 76b78c88..40a9368b 100644 --- a/app/models/metadata_content.rb +++ b/app/models/metadata_content.rb @@ -10,7 +10,10 @@ class MetadataContent < MetadataTemplate end def value - sanitize(self[:value] || document.content || default_value, + markdown = ReverseMarkdown.convert(self[:value]).strip + markdown = nil if markdown.blank? + + sanitize(markdown || document.content || default_value, sanitize_options).tr("\r", '') end diff --git a/doc/editor.md b/doc/editor.md index 2b5680ff..fdb3de3d 100644 --- a/doc/editor.md +++ b/doc/editor.md @@ -67,8 +67,6 @@ cada edición se van a degradar los textos sino. # TODO -* Soportar ~tachado~ en reverse_markdown -* Soportar
* No escapar los bloques de cita al sanitizar * Crear plugin que convierta imagenes remotas en locales * Probar qué otros adjuntos soporta trix y limitarlos (?)