aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-16 16:12:10 +0200
committerChocobozzz <me@florianbigard.com>2020-04-16 16:13:28 +0200
commit891bc2ffadd5dedae316fcc80856ff859e6f8336 (patch)
tree3fb13974f119a87d6fa45b4bcb8114ac34e00afa /client/src/app/shared
parent5600def4c87d3e6b7724489c9c4415778ea014d3 (diff)
downloadPeerTube-891bc2ffadd5dedae316fcc80856ff859e6f8336.tar.gz
PeerTube-891bc2ffadd5dedae316fcc80856ff859e6f8336.tar.zst
PeerTube-891bc2ffadd5dedae316fcc80856ff859e6f8336.zip
Support rel="me" links in markdown
Diffstat (limited to 'client/src/app/shared')
-rw-r--r--client/src/app/shared/renderer/html-renderer.service.ts7
1 files changed, 5 insertions, 2 deletions
diff --git a/client/src/app/shared/renderer/html-renderer.service.ts b/client/src/app/shared/renderer/html-renderer.service.ts
index 94a8aa4c6..1ddd8fe2f 100644
--- a/client/src/app/shared/renderer/html-renderer.service.ts
+++ b/client/src/app/shared/renderer/html-renderer.service.ts
@@ -19,15 +19,18 @@ export class HtmlRendererService {
19 allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ], 19 allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
20 allowedSchemes: [ 'http', 'https' ], 20 allowedSchemes: [ 'http', 'https' ],
21 allowedAttributes: { 21 allowedAttributes: {
22 'a': [ 'href', 'class', 'target' ] 22 'a': [ 'href', 'class', 'target', 'rel' ]
23 }, 23 },
24 transformTags: { 24 transformTags: {
25 a: (tagName, attribs) => { 25 a: (tagName, attribs) => {
26 let rel = 'noopener noreferrer'
27 if (attribs.rel === 'me') rel += ' me'
28
26 return { 29 return {
27 tagName, 30 tagName,
28 attribs: Object.assign(attribs, { 31 attribs: Object.assign(attribs, {
29 target: '_blank', 32 target: '_blank',
30 rel: 'noopener noreferrer' 33 rel
31 }) 34 })
32 } 35 }
33 } 36 }