Skip to content

Commit

Permalink
💭 Support verbatim comment environment in latex (#923)
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Feb 20, 2024
1 parent 5ed4fa6 commit 84a8966
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-lobsters-confess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tex-to-myst": patch
---

Support verbatim comment environment
4 changes: 4 additions & 0 deletions packages/tex-to-myst/src/verbatim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ function parseFirstLine(code?: string) {

export const VERBATIM_HANDLERS: Record<string, Handler> = {
verbatim(node, state) {
if (node.env === 'comment') {
state.pushNode(u('comment', { value: node?.content.trim() ?? '' }));
return;
}
state.closeParagraph();
const { value, lang, caption } = parseFirstLine(node.content);
if (caption) {
Expand Down
10 changes: 10 additions & 0 deletions packages/tex-to-myst/tests/verbatim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,13 @@ cases:
children:
- type: text
value: Hello world
- title: comment environment
tex: |-
\begin{comment}
This is a comment
\end{comment}
tree:
type: root
children:
- type: comment
value: This is a comment

0 comments on commit 84a8966

Please sign in to comment.