Skip to content

Build your personal knowledge base with Trilium Notes

refactor: katex.d.ts -> typings-external.ts

Tony Narlock8b7c6354eac4
diff --git a/src/augmentation.ts b/src/augmentation.ts
index 3f95f248e5..0651763689 100644
--- a/src/augmentation.ts
+++ b/src/augmentation.ts
@@ -1,4 +1,4 @@
-import type { KatexOptions } from './katex';
+import type { KatexOptions } from './typings-external';
declare module '@ckeditor/ckeditor5-core' {
interface EditorConfig {
diff --git a/src/katex.d.ts b/src/typings-external.ts
similarity index 96%
rename from src/katex.d.ts
rename to src/typings-external.ts
index 8a0dff93d3..d0bcf8b10d 100644
--- a/src/katex.d.ts
+++ b/src/typings-external.ts
@@ -1,14 +1,17 @@
-interface MathJax3 {
+/**
+ * Basic typings for third party, external libraries (KaTeX, MathJax).
+ */
+export interface MathJax3 {
version: string;
tex2chtmlPromise?: ( input: string, options: { display: boolean } ) => Promise<HTMLElement>;
tex2svgPromise?: ( input: string, options: { display: boolean } ) => Promise<HTMLElement>;
}
-interface MathJax2 {
+export interface MathJax2 {
Hub: { Queue: ( callback: [string, MathJax2['Hub'], string | HTMLElement] | ( () => void ) ) => void };
}
-interface Katex {
+export interface Katex {
render( equation: string, el: HTMLElement, options: KatexOptions ): void;
}
diff --git a/src/ui/mainformview.ts b/src/ui/mainformview.ts
index dc4897868f..0f302727fc 100644
--- a/src/ui/mainformview.ts
+++ b/src/ui/mainformview.ts
@@ -16,7 +16,7 @@ import { Locale, FocusTracker, KeystrokeHandler } from 'ckeditor5/src/utils';
import { extractDelimiters, hasDelimiters } from '../utils';
import MathView from './mathview';
import '../../theme/mathform.css';
-import type { KatexOptions } from '../katex';
+import type { KatexOptions } from '../typings-external';
const { check: checkIcon, cancel: cancelIcon } = icons;
diff --git a/src/ui/mathview.ts b/src/ui/mathview.ts
index 5ee587d164..98cb875ad4 100644
--- a/src/ui/mathview.ts
+++ b/src/ui/mathview.ts
@@ -1,7 +1,7 @@
import { View } from 'ckeditor5/src/ui';
+import type { KatexOptions } from '../typings-external';
import { renderEquation } from '../utils';
import type { Locale } from 'ckeditor5/src/utils';
-import type { KatexOptions } from '../katex';
export default class MathView extends View {
public value: string;
diff --git a/src/utils.ts b/src/utils.ts
index 31a68e91f6..a5a86909f7 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -5,7 +5,7 @@ import type {
} from 'ckeditor5/src/engine';
import { BalloonPanelView } from 'ckeditor5/src/ui';
import { CKEditorError, type PositioningFunction } from 'ckeditor5/src/utils';
-import type { KatexOptions, MathJax2, MathJax3 } from './katex';
+import type { KatexOptions, MathJax2, MathJax3 } from './typings-external';
export function getSelectedMathModelWidget(
selection: DocumentSelection