]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Support basic markdown in comments
authorChocobozzz <me@florianbigard.com>
Mon, 9 Dec 2019 10:21:39 +0000 (11:21 +0100)
committerChocobozzz <me@florianbigard.com>
Mon, 9 Dec 2019 10:21:39 +0000 (11:21 +0100)
client/src/app/shared/renderer/html-renderer.service.ts
client/src/app/videos/+video-watch/comment/video-comment.component.ts

index 28ef51e727b51be1d3e5d20f7cacb02f69a1b135..94a8aa4c655742aa929350f4647e75189cfab6ce 100644 (file)
@@ -16,7 +16,7 @@ export class HtmlRendererService {
     const html = this.linkifier.linkify(text)
 
     return sanitizeHtml(html, {
-      allowedTags: [ 'a', 'p', 'span', 'br' ],
+      allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
       allowedSchemes: [ 'http', 'https' ],
       allowedAttributes: {
         'a': [ 'href', 'class', 'target' ]
index 4d3c049a1913f99f5d692f5867fec45464160e92..23ff20aad82ad3c061eccccb9b97c5ceadb68919 100644 (file)
@@ -4,7 +4,7 @@ import { VideoCommentThreadTree } from '../../../../../../shared/models/videos/v
 import { AuthService } from '../../../core/auth'
 import { Video } from '../../../shared/video/video.model'
 import { VideoComment } from './video-comment.model'
-import { HtmlRendererService } from '@app/shared/renderer'
+import { MarkdownService } from '@app/shared/renderer'
 
 @Component({
   selector: 'my-video-comment',
@@ -28,7 +28,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
   newParentComments: VideoComment[] = []
 
   constructor (
-    private htmlRenderer: HtmlRendererService,
+    private markdownService: MarkdownService,
     private authService: AuthService
   ) {}
 
@@ -86,7 +86,7 @@ export class VideoCommentComponent implements OnInit, OnChanges {
   }
 
   private async init () {
-    this.sanitizedCommentHTML = await this.htmlRenderer.toSafeHtml(this.comment.text)
+    this.sanitizedCommentHTML = await this.markdownService.textMarkdownToHTML(this.comment.text, true)
 
     this.newParentComments = this.parentComments.concat([ this.comment ])
   }