From 54e597db7ec6c6cdfc3b4616d752c66da81481d2 Mon Sep 17 00:00:00 2001 From: Greg Price Date: Thu, 26 Mar 2020 14:54:34 -0700 Subject: [PATCH] webview: Add LaTeX math support! This incorporates the same KaTeX library we use in the Zulip webapp. We add the dependency, add a build-webview step to copy the needed files, and apply the stylesheet in our WebView HTML. There are a couple of cases where the resulting HTML and CSS doesn't quite look right. We'll go on to take care of those in upcoming commits. Fixes: #2660 --- package.json | 1 + src/webview/css/css.js | 1 + tools/build-webview | 21 ++++++++++++++++++++- yarn.lock | 7 +++++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f300e2dead..eec2fa1ec4b 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "blueimp-md5": "^2.10.0", "color": "^3.0.0", "date-fns": "^1.29.0", + "katex": "^0.11.1", "lodash.escape": "^4.0.1", "lodash.isequal": "^4.4.0", "lodash.omit": "^4.5.0", diff --git a/src/webview/css/css.js b/src/webview/css/css.js index 2bed42de1f2..0440b418140 100644 --- a/src/webview/css/css.js +++ b/src/webview/css/css.js @@ -6,6 +6,7 @@ import cssNight from './cssNight'; export default (theme: ThemeName) => ` +