Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mhchem katex extension #678

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions solara/components/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def _markdown_template(
await this.loadRequire();
this.mermaid = await this.loadMermaid();
this.mermaid.init();
await this.loadMHchem();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we need to move that to after line 110, if/when we use katex.

this.latexSettings = {
delimiters: [
{left: "$$", right: "$$", display: true},
Expand Down Expand Up @@ -157,6 +158,11 @@ def _markdown_template(
async loadMermaid() {
return (await this.import([`${this.getCdn()}/mermaid@10.8.0/dist/mermaid.min.js`]))[0]
},
async loadMHchem() {
await this.loadKatex();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await this.loadKatex();
await this.loadKatex();
Suggested change
await this.loadKatex();

This will cause the CSS to be added twice,

return (await this.import([`${this.getCdn()}/katex@0.16.9/dist/contrib/mhchem.min.js`]))[0];
},

import(dependencies) {
return this.loadRequire().then(
() => {
Expand Down
Loading