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

bug(typst): inline-math crashes #1605

Closed
aarnphm opened this issue Nov 19, 2024 · 6 comments
Closed

bug(typst): inline-math crashes #1605

aarnphm opened this issue Nov 19, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@aarnphm
Copy link
Collaborator

aarnphm commented Nov 19, 2024

see #1569

@aarnphm aarnphm added the bug Something isn't working label Nov 19, 2024
@kimhanm
Copy link
Contributor

kimhanm commented Nov 21, 2024

I managed to track the bug to the upstream rehype-typst package. Its inline math template (found in node_modules/.../rehype-typst/lib/index.js)

#set page(height: auto, width: auto, margin: 0pt)

#let s = state("t", (:))

#let pin(t) = locate(loc => {
  style(styles => s.update(it => it.insert(t, measure(line(length: loc.position().y + 0.25em), styles).width) + it))
})

#show math.equation: it => {
  box(it, inset: (top: 0.5em, bottom: 0.5em))
}

$pin("l1")x$

#locate(loc => [
  #metadata(s.final(loc).at("l1")) <label>
])

generates an error upon compilation with typst directly, as it needs to be wrapped in "context expression" (see https://typst.app/docs/reference/context/). I haven't figured that out yet but I assume that is all that needs to be done.

@kimhanm
Copy link
Contributor

kimhanm commented Nov 21, 2024

Created an upstream PR here: Myriad-Dreamin/typst.ts#604
As far as I can tell, it doesn't require any changes to the quartz project apart from updating the dependency once it gets merged.

@aarnphm
Copy link
Collaborator Author

aarnphm commented Nov 22, 2024

Yeah we can let dependabot to do it so no worries. Thanks for leading the work.

@kimhanm
Copy link
Contributor

kimhanm commented Dec 11, 2024

Upstream branch got merged. Should only require version update to close this.

@aarnphm
Copy link
Collaborator Author

aarnphm commented Dec 12, 2024

I think once the dependabot upgrade it we can check it again and close it. Thanks for the work upstream.

@aarnphm aarnphm closed this as completed Dec 17, 2024
@aarnphm
Copy link
Collaborator Author

aarnphm commented Dec 17, 2024

This is now fixed upstream and the dependabot PR is included.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants