Skip to content

Commit

Permalink
fix inlineMathTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
kimhanm authored and Enter-tainer committed Dec 10, 2024
1 parent c4e5d9c commit fbfcb2e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions projects/rehype-typst/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,20 @@ async function renderToSVGString_($typst, code, displayMode) {
#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))
})
#let pin(t) = context {
let width = measure(line(length: here().position().y + 0.25em)).width
s.update(it => it.insert(t, width) + it)
}
#show math.equation: it => {
box(it, inset: (top: 0.5em, bottom: 0.5em))
}
$pin("l1")${code}$
#locate(loc => [
#metadata(s.final(loc).at("l1")) <label>
])
#context [
#metadata(s.final().at("l1")) <label>
]
`;
const displayMathTemplate = `
#set page(height: auto, width: auto, margin: 0pt)
Expand Down

0 comments on commit fbfcb2e

Please sign in to comment.