Skip to content

Fix collapsed inline math blocks - #72

Open
A-Walrus wants to merge 1 commit into
fenjalien:masterfrom
A-Walrus:master
Open

Fix collapsed inline math blocks#72
A-Walrus wants to merge 1 commit into
fenjalien:masterfrom
A-Walrus:master

Conversation

@A-Walrus

@A-Walrus A-Walrus commented Mar 1, 2025

Copy link
Copy Markdown

Fixes #69.
Calculate the width and height manually instead of relying on clientHeight/clientWidth which don't work on hidden elements.

Calculate the width and height manually instead of relying on
clientHeight/clientWidth which don't work on hidden elements.
@michihupf

Copy link
Copy Markdown

Is there any reason this has not been merged yet? I have tried and failed to build your repo (@A-Walrus) from source as not having reliable rendering in callouts makes this plugin unusable for me.

The code seems clear enough, no merge conflicts...

@VincentTam

VincentTam commented Aug 30, 2025

Copy link
Copy Markdown

I've just merged this PR on top of mine, and I can say that is plugin almost solves the linked issue.
image
The typst interpretation inside the codeblock and inline math mode is correct. However, inside a collapsible display math mode marked by $$…$$, != didn't get interpreted into unless I put it inside a typst codeblock.

File that I used for testing:

Typst code blocks:

> [!note]- Secret facts
> $1 + 2 = 3$
> $$a + b != c$$
> ```typst
> #import "@preview/cetz:0.3.1"
> 
> Hello World
> 
> Hi this is Vin
> $
> sum_(i=1)^n 1/2^i != 1 - 1/2^n.
> $
> 
> #cetz.canvas({
>   import cetz.draw: *
> 
>   grid((-1.5, -1.5), (1.4, 1.4), step: 0.5, stroke: black + 0.2pt)
> })
> ```

Display math blocks:
> [!note]- Secret facts
> $$1 + 1 = 2$$, but $$1 + 2 != 2$$.

Expanded by default:
> [!note]+ Secret facts
> $1 + 1 = 2$, but $1 + 2 != 2$.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In-line math blocks don't render inside collapse-by-default callouts

3 participants