From 21a7231510afb33cbfcb30595f18b7c45f493ee7 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed, 28 Apr 2021 12:21:41 +0200
Subject: [PATCH] showcase: Fix syntax highlighting

Include the highlight.js css in all activities and move the
code css into the app, so it's defined where it is used.
---
 packages/common/styles.js      |  9 ---------
 toolkit-showcase/src/styles.js | 20 +++++++++++++++++++-
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/packages/common/styles.js b/packages/common/styles.js
index a7404faf..c0719805 100644
--- a/packages/common/styles.js
+++ b/packages/common/styles.js
@@ -55,15 +55,6 @@ export function getGeneralCSS(doMarginPaddingReset = true) {
             margin-bottom: 0.75rem;
         }
 
-        code {
-            background-color: var(--dbp-light);
-            color: var(--dbp-danger-bg-color);
-            font-size: 1em;
-            line-height: 1.5em;
-            font-weight: normal;
-            padding: 0.25em 0.5em 0.25em;
-        }
-
         .field:not(:last-child) {
             margin-bottom: 0.75rem;
         }
diff --git a/toolkit-showcase/src/styles.js b/toolkit-showcase/src/styles.js
index 468ab88d..540afdde 100644
--- a/toolkit-showcase/src/styles.js
+++ b/toolkit-showcase/src/styles.js
@@ -1,4 +1,6 @@
-import {css, CSSResult} from 'lit-element';
+import {css, CSSResult, unsafeCSS} from 'lit-element';
+import * as commonUtils from '@dbp-toolkit/common/utils';
+import highlightCSSPath from 'highlight.js/styles/github.css';
 
 /**
  * We want to have "neutral" colors here
@@ -8,6 +10,8 @@ import {css, CSSResult} from 'lit-element';
 export function getDemoCSS() {
     // language=css
     return css`
+        @import url("${unsafeCSS(commonUtils.getAssetURL(highlightCSSPath))}");
+
         h1.title {margin-bottom: 1em;}
         div.container {margin-bottom: 1.5em;}
         h1, h2, h3, h4 {
@@ -71,5 +75,19 @@ export function getDemoCSS() {
                 -webkit-filter: invert(0%);
             }
         }
+
+        pre {
+            background-color: var(--dbp-light);
+            padding: 0.4em;
+            overflow-x: auto;
+            border: 1px solid #ddd;
+        }
+
+        code {
+            background-color: var(--dbp-light);
+            line-height: 1.5em;
+            font-weight: normal;
+            padding: 0.25em 0.5em 0.25em;
+        }
     `;
 }
\ No newline at end of file
-- 
GitLab