From 8c7725dc3c01a73bf56a48c8b192d144bfdc3ffe Mon Sep 17 00:00:00 2001 From: Kim <1877318+kimsible@users.noreply.github.com> Date: Mon, 20 Apr 2020 14:51:24 +0200 Subject: Add markdown support to plugins (#2654) * Add markdown renderer to plugins * Chore: add doc for markdown plugins * Fix typing markdown plugin helpers * Add lines between components in template Co-authored-by: kimsible --- client/src/app/core/plugins/plugin.service.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'client/src/app/core') diff --git a/client/src/app/core/plugins/plugin.service.ts b/client/src/app/core/plugins/plugin.service.ts index 039fd6ff1..3ed23160d 100644 --- a/client/src/app/core/plugins/plugin.service.ts +++ b/client/src/app/core/plugins/plugin.service.ts @@ -15,6 +15,7 @@ import { HttpClient } from '@angular/common/http' import { AuthService } from '@app/core/auth' import { Notifier } from '@app/core/notification' import { RestExtractor } from '@app/shared/rest' +import { MarkdownService } from '@app/shared/renderer' import { PluginType } from '@shared/models/plugins/plugin.type' import { PublicServerSetting } from '@shared/models/plugins/public-server.setting' import { getDevLocale, isOnDevLocale } from '@app/shared/i18n/i18n-utils' @@ -65,6 +66,7 @@ export class PluginService implements ClientHook { private router: Router, private authService: AuthService, private notifier: Notifier, + private markdownRenderer: MarkdownService, private server: ServerService, private zone: NgZone, private authHttp: HttpClient, @@ -297,6 +299,16 @@ export class PluginService implements ClientHook { this.customModal.show(input) }, + markdownRenderer: { + textMarkdownToHTML: (textMarkdown: string) => { + return this.markdownRenderer.textMarkdownToHTML(textMarkdown) + }, + + enhancedMarkdownToHTML: (enhancedMarkdown: string) => { + return this.markdownRenderer.enhancedMarkdownToHTML(enhancedMarkdown) + } + }, + translate: (value: string) => { return this.translationsObservable .pipe(map(allTranslations => allTranslations[npmName])) -- cgit v1.2.3