From 6e38bf3fa07e94dcc398a3a6c9c5ec666243d848 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Mon, 14 Oct 2024 11:37:00 -0400 Subject: [PATCH] Fix link attribute bug in markdown-it-synapse --- packages/markdown-it-synapse/package.json | 2 +- packages/markdown-it-synapse/src/index.ts | 4 ++-- .../markdown-it-synapse/test/fixtures/synapse.txt | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/markdown-it-synapse/package.json b/packages/markdown-it-synapse/package.json index b721124541..51d7dfba0a 100644 --- a/packages/markdown-it-synapse/package.json +++ b/packages/markdown-it-synapse/package.json @@ -1,6 +1,6 @@ { "name": "markdown-it-synapse", - "version": "1.1.16", + "version": "1.1.17", "description": "tag for markdown-it markdown parser.", "main": "dist/index.cjs", "module": "dist/index.js", diff --git a/packages/markdown-it-synapse/src/index.ts b/packages/markdown-it-synapse/src/index.ts index 297f2ad8a2..63c71d3f87 100644 --- a/packages/markdown-it-synapse/src/index.ts +++ b/packages/markdown-it-synapse/src/index.ts @@ -346,11 +346,11 @@ function init_markdown_it( // if it has no href OR it is neither a synapse link or internal page link if (hrefIndex < 0 || !(isInternalPageLink || isInternalSynapseLink)) { tokens[idx].attrPush(['target', '_blank']) // add new attribute - tokens[idx].attrPush(['ref', 'noopener noreferrer']) // add new attribute + tokens[idx].attrPush(['rel', 'noopener noreferrer']) // add new attribute } } else { tokens[idx].attrs[aIndex][1] = '_blank' // replace value of existing attr - tokens[idx].attrPush(['ref', 'noopener noreferrer']) // add ref + tokens[idx].attrPush(['rel', 'noopener noreferrer']) // add ref } // pass token to default renderer. diff --git a/packages/markdown-it-synapse/test/fixtures/synapse.txt b/packages/markdown-it-synapse/test/fixtures/synapse.txt index 1c1e84854e..28934be618 100644 --- a/packages/markdown-it-synapse/test/fixtures/synapse.txt +++ b/packages/markdown-it-synapse/test/fixtures/synapse.txt @@ -67,37 +67,37 @@ And here's another ${reference?inlineWidget=true&text=My %5Freference%5F with pr . What if I mention @jay in a comment? . -

What if I mention @jay in a comment?

+

What if I mention @jay in a comment?

. . @Beginning of line mention . -

@Beginning of line mention

+

@Beginning of line mention

. . Mention at the @end . -

Mention at the @end

+

Mention at the @end

. . Mention @xschildw, @withSupportedSpecialCharacters-._, @test! Expectation that it will not eat the comma or exclamation point. . -

Mention @xschildw, @withSupportedSpecialCharacters-._, @test! Expectation that it will not eat the comma or exclamation point.

+

Mention @xschildw, @withSupportedSpecialCharacters-._, @test! Expectation that it will not eat the comma or exclamation point.

. . An email@address.com is not a mention . -

An email@address.com is not a mention

+

An email@address.com is not a mention

. . testing standard [link](http://link.com) . -

testing standard link

+

testing standard link

. . @@ -109,7 +109,7 @@ testing standard linkify syn123 auto-link . testing standard https://www.google.com auto-link . -

testing standard https://www.google.com auto-link

+

testing standard https://www.google.com auto-link

. .