Don't add target and rel attrs to links in post content
This commit is contained in:
parent
f975167ea7
commit
023bdb2a5f
2 changed files with 2 additions and 6 deletions
|
@ -19,10 +19,6 @@ const markdownLite = new MarkdownIt({ linkify: true, breaks: true })
|
|||
"strikethrough",
|
||||
"image",
|
||||
])
|
||||
.use(
|
||||
MarkdownItLinkAttrs,
|
||||
{ attrs: { target: "_blank", rel: "noopener" } },
|
||||
)
|
||||
|
||||
// Remove \n from output
|
||||
markdownLite.renderer.rules.hardbreak = () => "<br>"
|
||||
|
|
|
@ -9,11 +9,11 @@ describe("Render markdown", () => {
|
|||
|
||||
it("Render markdown lite", () => {
|
||||
const html = renderMarkdownLite(text)
|
||||
expect(html).to.equal('<p># heading</p><p>test <strong>bold</strong> test <em>italic</em> test ~~strike~~ with <code>code</code>, <span>html</span> and <a href="https://example.com" target="_blank" rel="noopener">https://example.com</a><br>new line</p><p>two new lines and a list:<br>- item 1<br>- item 2</p><p>code block:</p><pre><code>let test\ntest = 1\n</code></pre>')
|
||||
expect(html).to.equal('<p># heading</p><p>test <strong>bold</strong> test <em>italic</em> test ~~strike~~ with <code>code</code>, <span>html</span> and <a href="https://example.com">https://example.com</a><br>new line</p><p>two new lines and a list:<br>- item 1<br>- item 2</p><p>code block:</p><pre><code>let test\ntest = 1\n</code></pre>')
|
||||
})
|
||||
|
||||
it("Render markdown lite inline", () => {
|
||||
const html = renderMarkdownLiteInline(text)
|
||||
expect(html).to.equal('# heading<br><br>test <strong>bold</strong> test <em>italic</em> test ~~strike~~ with <code>code</code>, <span>html</span> and <a href="https://example.com" target="_blank" rel="noopener">https://example.com</a><br>new line<br><br>two new lines and a list:<br>- item 1<br>- item 2<br><br>code block:<br><code>let test test = 1</code>')
|
||||
expect(html).to.equal('# heading<br><br>test <strong>bold</strong> test <em>italic</em> test ~~strike~~ with <code>code</code>, <span>html</span> and <a href="https://example.com">https://example.com</a><br>new line<br><br>two new lines and a list:<br>- item 1<br>- item 2<br><br>code block:<br><code>let test test = 1</code>')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue