Skip to content

Commit

Permalink
🔧 Fix project cross-references in typst (#1742)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch authored Jan 9, 2025
1 parent 2ab9bfd commit 2c8fa97
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/new-birds-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-to-typst': patch
---

Fix typst crossreferences to other pages
4 changes: 2 additions & 2 deletions packages/myst-to-typst/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,10 @@ const handlers: Record<string, Handler> = {
legend: captionHandler,
captionNumber: () => undefined,
crossReference(node: CrossReference, state, parent) {
if (node.remote) {
if (node.remoteBaseUrl) {
// We don't want to handle remote references, treat them as links
const url =
(node.remoteBaseUrl ?? '') +
node.remoteBaseUrl +
(node.url === '/' ? '' : node.url ?? '') +
(node.html_id ? `#${node.html_id}` : '');
linkHandler({ ...node, url: url }, state);
Expand Down

0 comments on commit 2c8fa97

Please sign in to comment.