-
Notifications
You must be signed in to change notification settings - Fork 45
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
Latex support #425
Comments
I assume that should be pretty much doable, you'd need to parse out the blocks that you want to support (e.g. Adding new formats is reasonably easy so I'd say go for it! |
Sorry for the inactivity. We have had a "beta" version for quite some time, and we made some decisions we would like to ask your opinion about. The LaTeX lexer is defined in a new file, as to separate it from the Markdown one. We chose to do it this way because the user might, just as I'm doing later in this post, write LaTeX inside Markdown or vice versa and use syntax that mdx will then lex as if we were inside a LaTeX file. LaTeX doesn't have code listings by default, so we assume the user has defined an environment for OCaml code and the mdx-errors, each called % LSTLISTING
\usepackage{listings}
\lstnewenvironment{ocaml}
{\lstset{language=[Objective]Caml}}
{} % styling
\lstnewenvironment{mdx-error}
{\lstset{language=[Objective]Caml}}
{} % styling
% MINTED
\usepackage{minted}
\newminted[ocaml]{ocaml}{
% styling
}
\newminted[mdx-error]{ocaml}{
% styling
} The cmt labels are defined above the code listing in a comment, and the legacy labels are put inside square brackets after the % $MDX file=any_file.txt
\begin{ocaml}[version=4.14]
...
\end{ocaml} We aren't sure if putting the legacy labels in square brackets like this is a good idea, as the user might want to, for example, define some specific style for this environment using the square brackets and they will get parsed to mdx this way. We also haven't implemented the tests yet, but we are working on it. |
I would say this is a bad idea, it might indeed cause issues if the user wants to put arguments to the environment as well: e.g. when the environment options and the mdx labels conflict. In general these are "legacy" labels, so I think it is perfectly fine to not implement them in a new parser, as there are no existing LaTeX files that would be using them so no need to preserve compatibility. Wrt to the listings, I think the |
We have fixed this, now only the normal mdx labels work.
If we understand correctly, the idea would be to try to parse |
Hi 👋, me and my friend @zazedd want to add support for LaTeX.
Basically, we want to extend the project so that the lexer can read the LaTeX option (the idea is to add a new lexer file).
We want the LaTeX option to work as the Markdown one seamlessly, when reading a .tex file the lexer to be used is the one we would implement.
Thanks for taking the time to read this issue and for this amazing project.
The text was updated successfully, but these errors were encountered: