Explicitly open markdown links in the same window

We were already opening them in the same window because we were
accidentall sanitizing the `target` attribute, but now we're making the
point more explicit.
This commit is contained in:
Javi Martín
2023-10-16 00:29:47 +02:00
parent aeff8a0f31
commit 827bb125b2
2 changed files with 7 additions and 1 deletions

View File

@@ -30,7 +30,7 @@ class MarkdownConverter
{
filter_html: false,
hard_wrap: true,
link_attributes: { target: "_blank" }
link_attributes: {}
}
end

View File

@@ -38,6 +38,12 @@ describe Legislation::DraftVersion do
expect(legislation_draft_version.toc_html).to eq(toc_html)
end
it "does not add a target attribute to links" do
legislation_draft_version.body = "A [link](/url)"
expect(legislation_draft_version.body_html).to eq("<p>A <a href=\"/url\">link</a></p>\n")
end
def body_markdown
<<~BODY_MARKDOWN
# Title 1