MarTeX-Cpp

MarTeX-Cpp is a flexable, extendable and fast TeX-to-HTML converter by fully tokenizing-lexing-parsing-interpreting the TeX source. It can be compiled to serve as a module for different languages, like PHP or JavaScript. It's goal is to provide a way to allow users to write TeX they are familiar with to produce nice looking pages like this one, but without allowing code injection.

Styling

Special Characters

Command Result Command Result
\& & \"AaEeIiOoUuy ÄäËëÏïÖöÜüÿ
\% % \'AaEeIiOoUuZ ÁáÉéÍíÓóÚúŹ
\$ $ \`AaEeIiOoUu ÀàÈèÌìÒòÙù
\copy © \^AaEeIiOoUu ÂâÊêÎîÔôÛû
\> > \^AaEeIiOoUu ÂâÊêÎîÔôÛû
\< < \~AaIiOoNnUu ÃãĨĩÕõÑñŨũ
\} } \.AaUu ÅåŮů
\{ { \-Oo Øø
\cdot · \ss ß
\euro \Alpha\alpha Αα
\pound £ \Beta\beta Ββ
\deg ° ...
\backslash \ \Omega\omega Ωω

Images

Images are pretty. Normally the images try to fill the page width, you can control this behaviour with the provided sizing options. If you add a caption to an image it will put "Figure 1: caption" under it. You can change "Figure" to , for example, "Picture" by setting the header with a \define{header}{Picture }.

\begin{figure}
    \includegraphics{test.png}
    \caption{This is a test image}
    \label{testimage}
    \width{120px}
    \height{30}
    \alttext{A mouse!}
\end{figure}

Lists

Note that there are two different list environments: enumerate and itemize with a different default markers, respectively numbers and bullets.

\begin{itemize}
    \setmarker{square}
    \item Apple
    \item Banana
    \item Kiwi 
    \item Pear
\end{itemize}

Tables

Tables are a good way to represent content in a neat way. In MarTeX they behave pretty similar to the LaTeX tabulars. The tabular format accepts '|' for vertical lines, 'l' for left aligned column, 'c' for a centered column and 'r' for a right aligned column.

\begin{tabular}[|| l | c | r ||]
    \hline \hline
    1 & 2 & 3 \\\hline
    4 & 5 & 6 \\\hline
    7 & 8 & 9 \\\hline
    \multicolumn{3}{| c |}{0} \\
    \hline
\end{tabular}

Contributing

Please feel free to submit anything! The only thing I ask is that you include at least one test that verifies the behaviour of your change.

Bug Bounty Program

If you find a way insert arbitrary html tags and/or get javascript execution from a certain input string then first I'd like to congratualate you on a job well done! Please contact me privately with said input and we'll work on pushing out a fix as quickly as possible. Because I'm still a student there is unfortunately no hard cash to be made here, but certainly there is coffee and cake in it for you!

links

Authors

Acknowledgments

Thanks to my committee for their endless patience and enthusiasm while listening to me whining on about this.
Thanks to Diego Perini for writing a nifty regex-based URL validator.

License

This project is licensed under the MIT License - see the LICENSE.md file for details