})
)
.subscribe(async ({ videoChannel, videos, total }) => {
- this.channelsDescriptionHTML[videoChannel.id] = await this.markdown.textMarkdownToHTML(videoChannel.description)
+ this.channelsDescriptionHTML[videoChannel.id] = await this.markdown.textMarkdownToHTML({
+ markdown: videoChannel.description,
+ withEmoji: true,
+ withHtml: true
+ })
this.videoChannels.push(videoChannel)
}
private async onAccount (account: Account) {
- this.accountDescriptionHTML = await this.markdown.textMarkdownToHTML(account.description)
+ this.accountDescriptionHTML = await this.markdown.textMarkdownToHTML({
+ markdown: account.description,
+ withEmoji: true,
+ withHtml: true
+ })
// After the markdown renderer to avoid layout changes
this.account = account
}
toHtml (text: string) {
- return this.markdownRenderer.textMarkdownToHTML(text)
+ return this.markdownRenderer.textMarkdownToHTML({ markdown: text })
}
async unblockVideo (entry: VideoBlacklist) {
}
toHtml (text: string) {
- return this.markdownRenderer.textMarkdownToHTML(text, true, true)
+ return this.markdownRenderer.textMarkdownToHTML({ markdown: text, withHtml: true, withEmoji: true })
}
isInSelectionMode () {
]))
)
.subscribe(async videoChannel => {
- this.channelDescriptionHTML = await this.markdown.textMarkdownToHTML(videoChannel.description)
- this.ownerDescriptionHTML = await this.markdown.textMarkdownToHTML(videoChannel.ownerAccount.description)
+ this.channelDescriptionHTML = await this.markdown.textMarkdownToHTML({
+ markdown: videoChannel.description,
+ withEmoji: true,
+ withHtml: true
+ })
+
+ this.ownerDescriptionHTML = await this.markdown.textMarkdownToHTML({
+ markdown: videoChannel.ownerAccount.description,
+ withEmoji: true,
+ withHtml: true
+ })
// After the markdown renderer to avoid layout changes
this.videoChannel = videoChannel
private async init () {
// Before HTML rendering restore line feed for markdown list compatibility
const commentText = this.comment.text.replace(/<br.?\/?>/g, '\r\n')
- const html = await this.markdownService.textMarkdownToHTML(commentText, true, true)
+ const html = await this.markdownService.textMarkdownToHTML({ markdown: commentText, withHtml: true, withEmoji: true })
this.sanitizedCommentHTML = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
this.newParentComments = this.parentComments.concat([ this.comment ])
}
private async setVideoDescriptionHTML () {
- const html = await this.markdownService.textMarkdownToHTML(this.video.description)
+ const html = await this.markdownService.textMarkdownToHTML({ markdown: this.video.description })
this.videoHTMLDescription = this.markdownService.processVideoTimestamps(this.video.shortUUID, html)
}
}
this.broadcastMessage = {
- message: await this.markdownService.unsafeMarkdownToHTML(messageConfig.message, true),
+ message: await this.markdownService.markdownToUnsafeHTML({ markdown: messageConfig.message }),
dismissable: messageConfig.dismissable,
class: classes[messageConfig.level]
}
markdownRenderer: {
textMarkdownToHTML: (textMarkdown: string) => {
- return this.markdownRenderer.textMarkdownToHTML(textMarkdown)
+ return this.markdownRenderer.textMarkdownToHTML({ markdown: textMarkdown })
},
enhancedMarkdownToHTML: (enhancedMarkdown: string) => {
- return this.markdownRenderer.enhancedMarkdownToHTML(enhancedMarkdown)
+ return this.markdownRenderer.enhancedMarkdownToHTML({ markdown: enhancedMarkdown })
}
},
constructor (private htmlRenderer: HtmlRendererService) {}
- textMarkdownToHTML (markdown: string, withHtml = false, withEmoji = false) {
+ textMarkdownToHTML (options: {
+ markdown: string
+ withHtml?: boolean
+ withEmoji?: boolean
+ }) {
+ const { markdown, withHtml = false, withEmoji = false } = options
+
if (withHtml) return this.render({ name: 'textWithHTMLMarkdownIt', markdown, withEmoji })
return this.render({ name: 'textMarkdownIt', markdown, withEmoji })
}
- enhancedMarkdownToHTML (markdown: string, withHtml = false, withEmoji = false) {
+ enhancedMarkdownToHTML (options: {
+ markdown: string
+ withHtml?: boolean
+ withEmoji?: boolean
+ }) {
+ const { markdown, withHtml = false, withEmoji = false } = options
+
if (withHtml) return this.render({ name: 'enhancedWithHTMLMarkdownIt', markdown, withEmoji })
return this.render({ name: 'enhancedMarkdownIt', markdown, withEmoji })
}
- unsafeMarkdownToHTML (markdown: string, _trustedInput: true) {
- return this.render({ name: 'unsafeMarkdownIt', markdown, withEmoji: true })
+ markdownToUnsafeHTML (options: { markdown: string }) {
+ return this.render({ name: 'unsafeMarkdownIt', markdown: options.markdown, withEmoji: true })
}
- customPageMarkdownToHTML (markdown: string, additionalAllowedTags: string[]) {
+ customPageMarkdownToHTML (options: {
+ markdown: string
+ additionalAllowedTags: string[]
+ }) {
+ const { markdown, additionalAllowedTags } = options
+
return this.render({ name: 'customPageMarkdownIt', markdown, withEmoji: true, additionalAllowedTags })
}
abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment`
} else {
const truncated = truncate(abuse.comment.text, { length: 100 })
- abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true)
- abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML(abuse.comment.text, true)
+ abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: truncated, withHtml: true })
+ abuse.commentHtml = await this.markdownRenderer.textMarkdownToHTML({ markdown: abuse.comment.text, withHtml: true })
}
}
}
private toHtml (text: string) {
- return this.markdownRenderer.textMarkdownToHTML(text)
+ return this.markdownRenderer.textMarkdownToHTML({ markdown: text })
}
}
}
async buildElement (text: string) {
- const html = await this.markdown.customPageMarkdownToHTML(text, this.getSupportedTags())
+ const html = await this.markdown.customPageMarkdownToHTML({ markdown: text, additionalAllowedTags: this.getSupportedTags() })
const rootElement = document.createElement('div')
rootElement.innerHTML = html
tap(channel => {
this.channel = channel
}),
- switchMap(() => from(this.markdown.textMarkdownToHTML(this.channel.description))),
+ switchMap(() => from(this.markdown.textMarkdownToHTML({
+ markdown: this.channel.description,
+ withEmoji: true,
+ withHtml: true
+ }))),
tap(html => {
this.descriptionHTML = html
}),
html = result
} else if (this.markdownType === 'text') {
- html = await this.markdownService.textMarkdownToHTML(text)
+ html = await this.markdownService.textMarkdownToHTML({ markdown: text })
} else {
- html = await this.markdownService.enhancedMarkdownToHTML(text)
+ html = await this.markdownService.enhancedMarkdownToHTML({ markdown: text })
}
if (this.markdownVideo) {
}
for (const key of Object.keys(html)) {
- html[key] = await this.markdownService.textMarkdownToHTML(about.instance[key])
+ html[key] = await this.markdownService.textMarkdownToHTML({ markdown: about.instance[key] })
}
return html
const support = this.video?.support || this.videoChannel.support
- this.markdownService.enhancedMarkdownToHTML(support)
+ this.markdownService.enhancedMarkdownToHTML({ markdown: support })
.then(r => {
this.htmlSupport = r
})
async ngOnInit () {
this.buildPlaylistUrl()
if (this.displayDescription) {
- this.playlistDescription = await this.markdownService.textMarkdownToHTML(this.playlist.description)
+ this.playlistDescription = await this.markdownService.textMarkdownToHTML({ markdown: this.playlist.description })
}
}