unsloth/studio/frontend/src
Daniel Han de60a3a994
Studio: fix currency and indentation edge cases in LaTeX rendering (#6957)
* Studio: fix link, currency and indentation edge cases in LaTeX rendering

Follow-up to #6914. Three fixes to studio/frontend/src/lib/latex.ts:

- Skip reference-link definition URLs ([id]: url) during delimiter
  conversion, so escaped parens in such URLs are not rewritten as math.
- Preserve the opener line's indentation when emitting a display $$ block,
  so a \[...\] inside a list item stays part of the list.
- Stop a currency amount from pairing with a converted span's opening $,
  which swallowed the price into math (for example $5 + x \(y\)).

* Exclude GFM footnote definitions from the reference-URL skip

A footnote definition like [^1]: \(x\) had its body treated as a link
destination, so leading math was left literal. Skip [^...] labels.

* Merge overlapping link destination regions

A reference-def token can nest inline-link spans (for example
[1]: http://h/[a](b)/foo\(x\)), so the combined spans could overlap and
isInRegion's binary search missed the outer one, rewriting the URL. Merge
overlapping spans before the search.

* Guard lineStart when the display opener is at index 0

Behavior is unchanged (lastIndexOf clamps a negative fromIndex to 0), but
the explicit guard avoids relying on that implicit clamp.

* Scope to indentation and currency fixes

Drop the reference-link URL protection added earlier. It guards a case
models effectively never emit (escaped parens in a reference-style URL),
and approximating CommonMark reference definitions with a regex needs
open-ended special-casing. Keep the two high-value fixes: preserve display
math indentation (including multi-line bodies) inside a list item, and stop
a currency amount from pairing with a converted span's opening dollar sign.
2026-07-08 03:13:32 -07:00
..
app Studio: multi-select export formats, portable FP8/INT8, GGUF LoRA, and source parity (#6767) 2026-07-03 08:25:10 -07:00
assets Studio: mascot images degrade gracefully instead of showing alt text (#6146) 2026-06-10 08:22:17 -07:00
components Studio: show Hugging Face address on hover for Hub and online model rows (#6382) (#6928) 2026-07-08 03:09:52 -07:00
config Speed up Studio startup path (#6899) 2026-07-07 18:08:07 -07:00
features Move New badge to System settings tab (#6963) 2026-07-08 01:51:34 -07:00
hooks Studio: multi-select export formats, portable FP8/INT8, GGUF LoRA, and source parity (#6767) 2026-07-03 08:25:10 -07:00
i18n Sort chat recents by last activity (#6844) 2026-07-07 17:54:32 +01:00
lib Studio: fix currency and indentation edge cases in LaTeX rendering (#6957) 2026-07-08 03:13:32 -07:00
shared studio/frontend: make toast and inline error text selectable and copyable (#5506) 2026-05-18 03:47:21 -07:00
stores Update license headers 2026-03-12 17:23:10 +00:00
types feat(studio): implement S3 dataset loading (completes #5951) (#6222) 2026-06-12 14:52:04 +02:00
utils Studio frontend: reduce and tighten code comments (#6099) 2026-06-08 23:10:35 -07:00
asset-queries.d.ts Studio: mascot images degrade gracefully instead of showing alt text (#6146) 2026-06-10 08:22:17 -07:00
index.css Studio: keep code block scrollbars off one-line code (#6474) 2026-06-22 05:04:03 -07:00
main.tsx Speed up Studio startup path (#6899) 2026-07-07 18:08:07 -07:00
speech-recognition.d.ts studio: redesign chat composer (#5891) 2026-06-03 06:07:30 -07:00