From 54a32a2e97cc9a1fd20ac949f90f6e4ba2c6a4f9 Mon Sep 17 00:00:00 2001 From: Corinne Durrmeyer Date: Mon, 22 Jul 2024 17:11:32 +0200 Subject: [PATCH 1/3] Add content to link title attributes --- app/lib/redcarpet/trusted_renderer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/lib/redcarpet/trusted_renderer.rb b/app/lib/redcarpet/trusted_renderer.rb index 850841135..afb2749f5 100644 --- a/app/lib/redcarpet/trusted_renderer.rb +++ b/app/lib/redcarpet/trusted_renderer.rb @@ -18,7 +18,7 @@ module Redcarpet } unless href.starts_with?('/') - html_options.merge!(title: new_tab_suffix(title), **external_link_attributes) + html_options.merge!(title: new_tab_suffix(content), **external_link_attributes) end content_tag(:a, content, html_options, false) From 4233c9aee5d64de0e0cbaf948b61faea89a81d24 Mon Sep 17 00:00:00 2001 From: Corinne Durrmeyer Date: Tue, 23 Jul 2024 10:36:21 +0200 Subject: [PATCH 2/3] Force line breaks in pre --- app/assets/stylesheets/01_common.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/assets/stylesheets/01_common.scss b/app/assets/stylesheets/01_common.scss index 47b94bc1d..6747e0ae5 100644 --- a/app/assets/stylesheets/01_common.scss +++ b/app/assets/stylesheets/01_common.scss @@ -11,6 +11,11 @@ body { min-height: 100%; } +// Wrap text in pre tag +pre { + white-space: pre-wrap; +} + // Mobile Safari doesn't bubble mouse events by default, unless: // // - the target element of the event is a link or a form field. From adba85755d5ba385fb4d3349ebc7a2e328334c87 Mon Sep 17 00:00:00 2001 From: Corinne Durrmeyer Date: Tue, 23 Jul 2024 12:02:56 +0200 Subject: [PATCH 3/3] Update spec file --- spec/lib/redcarpet/trusted_renderer_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/redcarpet/trusted_renderer_spec.rb b/spec/lib/redcarpet/trusted_renderer_spec.rb index b0be7a94a..c18efb124 100644 --- a/spec/lib/redcarpet/trusted_renderer_spec.rb +++ b/spec/lib/redcarpet/trusted_renderer_spec.rb @@ -10,7 +10,7 @@ RSpec.describe Redcarpet::TrustedRenderer do it 'renders external links with target="_blank" and rel="noopener noreferrer"' do markdown = "[Visit](http://example.com)" - expect(renderer.render(markdown)).to include('Visit') + expect(renderer.render(markdown)).to include('Visit') end end @@ -24,7 +24,7 @@ RSpec.describe Redcarpet::TrustedRenderer do context 'when autolinking' do it 'autolinks URLs' do markdown = "Visit http://example.com" - expect(renderer.render(markdown)).to include('Visit http://example.com') + expect(renderer.render(markdown)).to include('Visit http://example.com') end it 'autolinks email addresses with mailto' do