remove katex

reactions
Lerk 1 year ago
parent cea13aeb1b
commit 7bfac0df93
  1. BIN
      app/javascript/fonts/katex/KaTeX_AMS-Regular.ttf
  2. BIN
      app/javascript/fonts/katex/KaTeX_AMS-Regular.woff
  3. BIN
      app/javascript/fonts/katex/KaTeX_AMS-Regular.woff2
  4. BIN
      app/javascript/fonts/katex/KaTeX_Caligraphic-Bold.ttf
  5. BIN
      app/javascript/fonts/katex/KaTeX_Caligraphic-Bold.woff
  6. BIN
      app/javascript/fonts/katex/KaTeX_Caligraphic-Bold.woff2
  7. BIN
      app/javascript/fonts/katex/KaTeX_Caligraphic-Regular.ttf
  8. BIN
      app/javascript/fonts/katex/KaTeX_Caligraphic-Regular.woff
  9. BIN
      app/javascript/fonts/katex/KaTeX_Caligraphic-Regular.woff2
  10. BIN
      app/javascript/fonts/katex/KaTeX_Fraktur-Bold.ttf
  11. BIN
      app/javascript/fonts/katex/KaTeX_Fraktur-Bold.woff
  12. BIN
      app/javascript/fonts/katex/KaTeX_Fraktur-Bold.woff2
  13. BIN
      app/javascript/fonts/katex/KaTeX_Fraktur-Regular.ttf
  14. BIN
      app/javascript/fonts/katex/KaTeX_Fraktur-Regular.woff
  15. BIN
      app/javascript/fonts/katex/KaTeX_Fraktur-Regular.woff2
  16. BIN
      app/javascript/fonts/katex/KaTeX_Main-Bold.ttf
  17. BIN
      app/javascript/fonts/katex/KaTeX_Main-Bold.woff
  18. BIN
      app/javascript/fonts/katex/KaTeX_Main-Bold.woff2
  19. BIN
      app/javascript/fonts/katex/KaTeX_Main-BoldItalic.ttf
  20. BIN
      app/javascript/fonts/katex/KaTeX_Main-BoldItalic.woff
  21. BIN
      app/javascript/fonts/katex/KaTeX_Main-BoldItalic.woff2
  22. BIN
      app/javascript/fonts/katex/KaTeX_Main-Italic.ttf
  23. BIN
      app/javascript/fonts/katex/KaTeX_Main-Italic.woff
  24. BIN
      app/javascript/fonts/katex/KaTeX_Main-Italic.woff2
  25. BIN
      app/javascript/fonts/katex/KaTeX_Main-Regular.ttf
  26. BIN
      app/javascript/fonts/katex/KaTeX_Main-Regular.woff
  27. BIN
      app/javascript/fonts/katex/KaTeX_Main-Regular.woff2
  28. BIN
      app/javascript/fonts/katex/KaTeX_Math-BoldItalic.ttf
  29. BIN
      app/javascript/fonts/katex/KaTeX_Math-BoldItalic.woff
  30. BIN
      app/javascript/fonts/katex/KaTeX_Math-BoldItalic.woff2
  31. BIN
      app/javascript/fonts/katex/KaTeX_Math-Italic.ttf
  32. BIN
      app/javascript/fonts/katex/KaTeX_Math-Italic.woff
  33. BIN
      app/javascript/fonts/katex/KaTeX_Math-Italic.woff2
  34. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Bold.ttf
  35. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Bold.woff
  36. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Bold.woff2
  37. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Italic.ttf
  38. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Italic.woff
  39. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Italic.woff2
  40. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Regular.ttf
  41. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Regular.woff
  42. BIN
      app/javascript/fonts/katex/KaTeX_SansSerif-Regular.woff2
  43. BIN
      app/javascript/fonts/katex/KaTeX_Script-Regular.ttf
  44. BIN
      app/javascript/fonts/katex/KaTeX_Script-Regular.woff
  45. BIN
      app/javascript/fonts/katex/KaTeX_Script-Regular.woff2
  46. BIN
      app/javascript/fonts/katex/KaTeX_Size1-Regular.ttf
  47. BIN
      app/javascript/fonts/katex/KaTeX_Size1-Regular.woff
  48. BIN
      app/javascript/fonts/katex/KaTeX_Size1-Regular.woff2
  49. BIN
      app/javascript/fonts/katex/KaTeX_Size2-Regular.ttf
  50. BIN
      app/javascript/fonts/katex/KaTeX_Size2-Regular.woff
  51. BIN
      app/javascript/fonts/katex/KaTeX_Size2-Regular.woff2
  52. BIN
      app/javascript/fonts/katex/KaTeX_Size3-Regular.ttf
  53. BIN
      app/javascript/fonts/katex/KaTeX_Size3-Regular.woff
  54. BIN
      app/javascript/fonts/katex/KaTeX_Size3-Regular.woff2
  55. BIN
      app/javascript/fonts/katex/KaTeX_Size4-Regular.ttf
  56. BIN
      app/javascript/fonts/katex/KaTeX_Size4-Regular.woff
  57. BIN
      app/javascript/fonts/katex/KaTeX_Size4-Regular.woff2
  58. BIN
      app/javascript/fonts/katex/KaTeX_Typewriter-Regular.ttf
  59. BIN
      app/javascript/fonts/katex/KaTeX_Typewriter-Regular.woff
  60. BIN
      app/javascript/fonts/katex/KaTeX_Typewriter-Regular.woff2
  61. 39
      app/javascript/mastodon/components/status_content.js
  62. 2
      app/javascript/styles/application.scss
  63. 1093
      app/javascript/styles/fonts/katex.scss
  64. 1
      app/javascript/styles/night.scss
  65. 1
      package.json
  66. 12
      yarn.lock

@ -7,25 +7,10 @@ import classnames from 'classnames';
import PollContainer from 'mastodon/containers/poll_container';
import Icon from 'mastodon/components/icon';
import { autoPlayGif } from 'mastodon/initial_state';
import katex from 'katex/dist/katex.mjs';
// 20px * 32 (+ 2px padding at the top)
const MAX_HEIGHT = 642;
// Regex to match latex tags.
const TEX_REGEX = /<code>(?:(?!<\/code>).)+\\(?:(?!<\/code>).)+<\/code>/;
const TEX_REPLACES = [
{ src: '\\(', to: '' },
{ src: '\\)', to: '' },
];
const TEX_CONFIG = {
displayMode: true,
output: 'html',
macros: {
'\\f': 'f(#1)',
},
};
export default class StatusContent extends React.PureComponent {
static contextTypes = {
@ -183,28 +168,6 @@ export default class StatusContent extends React.PureComponent {
this.node = c;
}
renderTexIfNeeded = (status) => {
let content = { __html: status.get('contentHtml') };
const regex = new RegExp(TEX_REGEX, 'gi');
const matches = status.get('contentHtml').match(regex);
if(matches) {
for (const match of matches) {
try {
const domParser = new DOMParser();
let cleaned = domParser.parseFromString(match, 'text/html').body.textContent;
for (let replace of TEX_REPLACES) {
cleaned = cleaned.replace(replace.src, replace.to);
}
const rendered = katex.renderToString(cleaned, TEX_CONFIG);
content = { __html: rendered };
} catch (e) {
console.error(e);
}
}
}
return content;
}
render () {
const { status } = this.props;
@ -212,7 +175,7 @@ export default class StatusContent extends React.PureComponent {
const renderReadMore = this.props.onClick && status.get('collapsed');
const renderViewThread = this.props.showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']);
const content = this.renderTexIfNeeded(status);
const content = { __html: status.get('contentHtml') };
const spoilerContent = { __html: status.get('spoilerHtml') };
const classNames = classnames('status__content', {

@ -27,5 +27,3 @@
@import 'mastodon/rtl';
@import 'mastodon/accessibility';
@import 'mastodon/noscript';
@import 'fonts/katex';

File diff suppressed because it is too large Load Diff

@ -3,7 +3,6 @@
@import 'fonts/roboto';
@import 'fonts/roboto-mono';
@import 'fonts/montserrat';
@import 'fonts/katex';
@import 'mastodon/reset';
@import 'night/basics';

@ -107,7 +107,6 @@
"intl-relativeformat": "^6.4.3",
"is-nan": "^1.3.2",
"js-yaml": "^4.1.0",
"katex": "^0.13.13",
"lodash": "^4.17.21",
"mark-loader": "^0.1.6",
"marky": "^1.2.2",

@ -3251,11 +3251,6 @@ commander@^2.20.0, commander@^2.8.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33"
integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==
commander@^6.0.0:
version "6.2.1"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
commander@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.0.tgz#b990bfb8ac030aedc6d11bc04d1488ffef56db75"
@ -7007,13 +7002,6 @@ jsprim@^1.2.2:
array-includes "^3.1.1"
object.assign "^4.1.1"
katex@^0.13.13:
version "0.13.13"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.13.13.tgz#15a796e95516869bc6d483443b58b2df872ee40f"
integrity sha512-cCMcil4jwMm7behpXGiQfXJA29sko/Gd/26iCsr53Dv5Jn2iHbHyEb14dm9uVrIijUXx6Zz1WhlFhHE6DckvkQ==
dependencies:
commander "^6.0.0"
keycode@^2.1.7:
version "2.2.0"
resolved "https://registry.yarnpkg.com/keycode/-/keycode-2.2.0.tgz#3d0af56dc7b8b8e5cba8d0a97f107204eec22b04"

Loading…
Cancel
Save