From 83089b47d383932e25449bf1c0c2d1876f15c48f Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 16 Dec 2021 12:10:46 +0100 Subject: [PATCH] web/elements: add Markdown component to improve rendering Signed-off-by: Jens Langhammer --- web/src/elements/Markdown.ts | 25 ++++++++++++++ .../providers/proxy/ProxyProviderViewPage.ts | 34 ++++++++++++++----- 2 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 web/src/elements/Markdown.ts diff --git a/web/src/elements/Markdown.ts b/web/src/elements/Markdown.ts new file mode 100644 index 000000000..c95d302ef --- /dev/null +++ b/web/src/elements/Markdown.ts @@ -0,0 +1,25 @@ +import { CSSResult, LitElement, TemplateResult, html } from "lit"; +import { customElement, property } from "lit/decorators.js"; +import { unsafeHTML } from "lit/directives/unsafe-html.js"; + +import AKGlobal from "../authentik.css"; +import PFContent from "@patternfly/patternfly/components/Content/content.css"; +import PFList from "@patternfly/patternfly/components/List/list.css"; + +@customElement("ak-markdown") +export class Markdown extends LitElement { + @property() + md?: string; + + static get styles(): CSSResult[] { + return [PFList, PFContent, AKGlobal]; + } + + render(): TemplateResult { + if (!this.md) { + return html``; + } + const finalHTML = this.md.replace("