Skip to content

Commit

Permalink
🪧 Strike-through macros in latex (#1532)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 authored Sep 13, 2024
1 parent fb55995 commit 5d5c289
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/nine-llamas-march.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tex-to-myst": patch
---

Add cancel to latex
3 changes: 3 additions & 0 deletions packages/tex-to-myst/src/marks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const marks = {
textsubscript: 'subscript',
textsuperscript: 'superscript',
hl: 'strong', // This needs to be done!
cancel: 'delete',
bcancel: 'delete',
xcancel: 'delete',
};

const TEXT_MARKS_HANDLERS: Record<string, Handler> = {
Expand Down
4 changes: 4 additions & 0 deletions packages/tex-to-myst/src/tex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ const macros: Record<string, number> = {
t: 1,
u: 1,
v: 1,
// Cancel
cancel: 1,
bcancel: 1,
xcancel: 1,
};

// These macros allow a mix of {} and [] arguments, rather than only allowing
Expand Down
1 change: 1 addition & 0 deletions packages/tex-to-myst/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const phrasingTypes = new Set([
'smallcaps',
'link',
'span',
'delete',
]);

export const UNHANDLED_ERROR_TEXT = 'Unhandled TEX conversion';
Expand Down
11 changes: 11 additions & 0 deletions packages/tex-to-myst/tests/text.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,14 @@ cases:
children:
- type: text
value: ok ok
- title: Strike-through and delete
tex: \cancel{me}
tree:
type: root
children:
- type: paragraph
children:
- type: delete
children:
- type: text
value: me

0 comments on commit 5d5c289

Please sign in to comment.