-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
V2 Alpha #464
Open
pddg
wants to merge
12
commits into
master
Choose a base branch
from
v2alpha
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Input: % This is the beginning of the document
\documentclass{article} % This is a comment
\begin{document}
This is a paragraph that contains inline math: $E=mc^2$.
This is a second line.
This is a link: \href{http://google.com}{google}.
% This is the beginning of the nested document
\begin{itemize}
\item First item
\begin{itemize}
\item nested1
\item nested2
\end{itemize}
\item Second item
\end{itemize}
\begin{description}
\item[First] This is the first item
\item[Second] This is the second item
\end{description}
\begin{table}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
Column 1 & Column 2 & Column 3 \\
\hline
Row 1 & Row 1 & Row 1 \\
\hline
Row 2 & Row 2 & Row 2 \\
\hline
\end{tabular}
\end{center}
\end{table}
\begin{minted}{python}
def foo():
print("This is a python code block")
\end{minted}
\end{document} And the output is as follows: npx tex2tast ./sample.tex -r{
"type": "Document",
"raw": "% This is the beginning of the document\n\\documentclass{article} % This is a comment\n\n\\begin{document}\n\nThis is a paragraph that contains inline math: $E=mc^2$.\nThis is a second line.\n\nThis is a link: \\href{http://google.com}{google}.\n\n% This is the beginning of the nested document\n\\begin{itemize}\n \\item First item\n \\begin{itemize}\n \\item nested1\n \\item nested2\n \\end{itemize}\n \\item Second item\n\\end{itemize}\n\n\\begin{description}\n \\item[First] This is the first item\n \\item[Second] This is the second item\n\\end{description}\n\n\\begin{table}\n\\begin{center}\n\\begin{tabular}{|c|c|c|}\n \\hline\n Column 1 & Column 2 & Column 3 \\\\\n \\hline\n Row 1 & Row 1 & Row 1 \\\\\n \\hline\n Row 2 & Row 2 & Row 2 \\\\\n \\hline\n\\end{tabular}\n\\end{center}\n\\end{table}\n\n\\begin{minted}{python}\ndef foo():\n print(\"This is a python code block\")\n\\end{minted}\n\n\\end{document}\n",
"children": [
{
"type": "Comment",
"raw": "% This is the beginning of the document\n",
"value": " This is the beginning of the document"
},
{
"type": "Html",
"raw": "\\documentclass{article}",
"value": "article"
},
{
"type": "Comment",
"raw": " % This is a comment",
"value": " This is a comment"
},
{
"type": "Html",
"raw": "\n\n",
"value": ""
},
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "This is a paragraph that contains inline math: ",
"value": "This is a paragraph that contains inline math: "
},
{
"type": "Code",
"raw": "$E=mc^2$",
"value": "$E=mc^2$"
},
{
"type": "Str",
"raw": ".\nThis is a second line.",
"value": ".\nThis is a second line."
}
],
"raw": "This is a paragraph that contains inline math: $E=mc^2$.\nThis is a second line."
},
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "This is a link: ",
"value": "This is a link: "
},
{
"type": "Link",
"raw": "\\href{http://google.com}{google}",
"children": [
{
"type": "Str",
"raw": "google",
"value": "google"
}
],
"url": "http://google.com"
},
{
"type": "Str",
"raw": ".",
"value": "."
}
],
"raw": "This is a link: \\href{http://google.com}{google}."
},
{
"type": "Paragraph",
"children": [
{
"type": "Comment",
"raw": "% This is the beginning of the nested document\n",
"value": " This is the beginning of the nested document"
}
],
"raw": "% This is the beginning of the nested document\n"
},
{
"type": "List",
"children": [
{
"type": "ListItem",
"raw": "\\item First item\n \\begin{itemize}\n \\item nested1\n \\item nested2\n \\end{itemize}",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "First item\n ",
"value": "First item\n "
}
],
"raw": "First item\n "
},
{
"type": "List",
"children": [
{
"type": "ListItem",
"raw": "\\item nested1",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "nested1",
"value": "nested1"
}
],
"raw": "nested1"
}
]
},
{
"type": "ListItem",
"raw": "\\item nested2",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "nested2",
"value": "nested2"
}
],
"raw": "nested2"
}
]
}
],
"raw": "\\begin{itemize}\n \\item nested1\n \\item nested2\n \\end{itemize}"
}
]
},
{
"type": "ListItem",
"raw": "\\item Second item",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "Second item",
"value": "Second item"
}
],
"raw": "Second item"
}
]
}
],
"raw": "\\begin{itemize}\n \\item First item\n \\begin{itemize}\n \\item nested1\n \\item nested2\n \\end{itemize}\n \\item Second item\n\\end{itemize}"
},
{
"type": "List",
"children": [
{
"type": "ListItem",
"raw": "\\item[First] This is the first item",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "First",
"value": "First"
}
],
"raw": "First"
},
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "This is the first item",
"value": "This is the first item"
}
],
"raw": "This is the first item"
}
]
},
{
"type": "ListItem",
"raw": "\\item[Second] This is the second item",
"children": [
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "Second",
"value": "Second"
}
],
"raw": "Second"
},
{
"type": "Paragraph",
"children": [
{
"type": "Str",
"raw": "This is the second item",
"value": "This is the second item"
}
],
"raw": "This is the second item"
}
]
}
],
"raw": "\\begin{description}\n \\item[First] This is the first item\n \\item[Second] This is the second item\n\\end{description}"
},
{
"type": "Table",
"children": [
{
"type": "TableRow",
"children": [
{
"type": "TableCell",
"children": [
{
"type": "Html",
"raw": "\\hline",
"value": ""
},
{
"type": "Str",
"raw": "\n Column 1 ",
"value": "\n Column 1 "
}
],
"raw": "\\hline\n Column 1 "
},
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": " Column 2 ",
"value": " Column 2 "
}
],
"raw": " Column 2 "
},
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": " Column 3 ",
"value": " Column 3 "
}
],
"raw": " Column 3 "
}
],
"raw": "\\hline\n Column 1 & Column 2 & Column 3 \\\\"
},
{
"type": "TableRow",
"children": [
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": "\n ",
"value": "\n "
},
{
"type": "Html",
"raw": "\\hline",
"value": ""
},
{
"type": "Str",
"raw": "\n Row 1 ",
"value": "\n Row 1 "
}
],
"raw": "\n \\hline\n Row 1 "
},
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": " Row 1 ",
"value": " Row 1 "
}
],
"raw": " Row 1 "
},
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": " Row 1 ",
"value": " Row 1 "
}
],
"raw": " Row 1 "
}
],
"raw": "\n \\hline\n Row 1 & Row 1 & Row 1 \\\\"
},
{
"type": "TableRow",
"children": [
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": "\n ",
"value": "\n "
},
{
"type": "Html",
"raw": "\\hline",
"value": ""
},
{
"type": "Str",
"raw": "\n Row 2 ",
"value": "\n Row 2 "
}
],
"raw": "\n \\hline\n Row 2 "
},
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": " Row 2 ",
"value": " Row 2 "
}
],
"raw": " Row 2 "
},
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": " Row 2 ",
"value": " Row 2 "
}
],
"raw": " Row 2 "
}
],
"raw": "\n \\hline\n Row 2 & Row 2 & Row 2 \\\\"
},
{
"type": "TableRow",
"children": [
{
"type": "TableCell",
"children": [
{
"type": "Str",
"raw": "\n ",
"value": "\n "
},
{
"type": "Html",
"raw": "\\hline",
"value": ""
}
],
"raw": "\n \\hline"
}
],
"raw": "\n \\hline"
}
],
"raw": "\\begin{tabular}{|c|c|c|}\n \\hline\n Column 1 & Column 2 & Column 3 \\\\\n \\hline\n Row 1 & Row 1 & Row 1 \\\\\n \\hline\n Row 2 & Row 2 & Row 2 \\\\\n \\hline\n\\end{tabular}"
},
{
"type": "CodeBlock",
"raw": "\\begin{minted}{python}\ndef foo():\n print(\"This is a python code block\")\n\\end{minted}",
"value": "\ndef foo():\n print(\"This is a python code block\")\n"
}
]
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs #463
Sorry for the huge PR.
Some large changes in this PR is: