Skip to content

Commit

Permalink
\\ Latex support improvement for in-paragraph breaks (#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Feb 22, 2024
1 parent 6a97176 commit 822ee74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rich-cows-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tex-to-myst": patch
---

Change \\ in latex to add a break, already supported in tables.
4 changes: 3 additions & 1 deletion packages/tex-to-myst/src/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ export const BASIC_TEXT_HANDLERS: Record<string, Handler> = {
parbreak: closeParagraph,
macro_par: closeParagraph,
macro_break: closeParagraph,
['macro_\\']: closeParagraph,
['macro_\\'](node: GenericNode, state: ITexParser) {
state.addLeaf('break');
},
// newpage isn't really appropriate in a web context
// We could make this into a block in the future?
macro_newpage: closeParagraph,
Expand Down
1 change: 1 addition & 0 deletions packages/tex-to-myst/src/frontmatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function extractEmailFromName(author: { name?: GenericNode | string; email?: str
function getAuthorOrEmailFromNode(node: GenericNode | string) {
if (typeof node === 'string') return extractEmailFromName({ name: node });
const copy = copyNode(node);
remove(copy, 'break');
const author: { name?: GenericNode | string; email?: string } = {};
(selectAll('inlineCode,link', copy) as GenericNode[]).forEach((n) => {
const maybeEmail = toText(n);
Expand Down

0 comments on commit 822ee74

Please sign in to comment.