From 63c4b44961aa86ed4dabf039e495879103f9d729 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 23 Jan 2018 16:32:49 +0100 Subject: Avoid to linkify truncated links --- client/src/app/videos/shared/markdown.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/app/videos/shared/markdown.service.ts b/client/src/app/videos/shared/markdown.service.ts index d8b5b76b6..82745f0c6 100644 --- a/client/src/app/videos/shared/markdown.service.ts +++ b/client/src/app/videos/shared/markdown.service.ts @@ -35,6 +35,9 @@ export class MarkdownService { } markdownToHTML (markdown: string) { - return this.markdownIt.render(markdown) + const html = this.markdownIt.render(markdown) + + // Avoid linkify truncated links + return html.replace(/]+>([^<]+)<\/a>\s*...(<\/p>)?$/mi, '$1...') } } -- cgit v1.2.3