mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
[mastodon-client] Improve mfm-to-html handling of links
This commit is contained in:
parent
afee7b6174
commit
19f8c0aafc
1 changed files with 5 additions and 1 deletions
|
@ -123,6 +123,8 @@ export class MfmHelpers {
|
||||||
|
|
||||||
link(node) {
|
link(node) {
|
||||||
const a = doc.createElement("a");
|
const a = doc.createElement("a");
|
||||||
|
a.setAttribute("rel", "nofollow noopener noreferrer");
|
||||||
|
a.setAttribute("target", "_blank");
|
||||||
a.href = node.props.url;
|
a.href = node.props.url;
|
||||||
appendChildren(node.children, a);
|
appendChildren(node.children, a);
|
||||||
return a;
|
return a;
|
||||||
|
@ -178,8 +180,10 @@ export class MfmHelpers {
|
||||||
|
|
||||||
url(node) {
|
url(node) {
|
||||||
const a = doc.createElement("a");
|
const a = doc.createElement("a");
|
||||||
|
a.setAttribute("rel", "nofollow noopener noreferrer");
|
||||||
|
a.setAttribute("target", "_blank");
|
||||||
a.href = node.props.url;
|
a.href = node.props.url;
|
||||||
a.textContent = node.props.url;
|
a.textContent = node.props.url.replace(/^https?:\/\//, '');
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue