mirror of
https://github.com/slateblua/mathtype.git
synced 2026-07-22 12:20:24 +00:00
Render syntax
This commit is contained in:
parent
0d2129219a
commit
c5906ba701
1 changed files with 14 additions and 6 deletions
20
main.ts
20
main.ts
|
|
@ -6,6 +6,7 @@ import {
|
|||
EditorSuggestContext,
|
||||
EditorSuggestTriggerInfo,
|
||||
Plugin,
|
||||
MarkdownRenderer,
|
||||
PluginSettingTab,
|
||||
Setting
|
||||
} from 'obsidian';
|
||||
|
|
@ -228,12 +229,19 @@ class MathTypeSuggest extends EditorSuggest<string> {
|
|||
}
|
||||
|
||||
renderSuggestion(value: string, el: HTMLElement): void {
|
||||
const suggestionEl = el.createDiv({cls: "suggestion-item"});
|
||||
suggestionEl.createSpan({
|
||||
text: value,
|
||||
cls: "suggestion-content"
|
||||
});
|
||||
}
|
||||
const suggestionEl = el.createDiv({ cls: "suggestion-item" });
|
||||
|
||||
// Container for rendered MathJax output
|
||||
const renderedEl = suggestionEl.createDiv({ cls: "suggestion-rendered" });
|
||||
|
||||
MarkdownRenderer.render(
|
||||
this.app,
|
||||
`$$${value}$$`,
|
||||
renderedEl,
|
||||
'',
|
||||
this.plugin,
|
||||
);
|
||||
}
|
||||
|
||||
selectSuggestion(value: string, evt: MouseEvent | KeyboardEvent): void {
|
||||
if (!this.context) return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue