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.
Make a big fancy title.
Make a chapter title.
Make a section title.
Make a subsection title.
Make a subsubsection title.
Render Text in bold.
Render Text in italics.
Render Text underlined.
Render Text smallcaps.
Render Text monospaced.
Change the width of a rendered element.
Change the height of a rendered element.
Write superscript text.
Write subscript text.
Make a horizontal line.
Line break, equivalent to a double backslash.
Reference a label (from an image, for example). Works with both forward and backwards declaration (The label can be both above and below the ref command). Outputs a question mark when the label is undefined.
Set the global Variable to Value. Often used to change module behaviour.
Make a hyperlink to URL with text Text
Make a hyperlink to URL with text URL (so is like invoking \href{URL}{URL})
Change the colour of a piece of text. \colour{ff00ff}{text}
Change the background colour.
Change the fontsize .
Make the font tiny sized.
Make the font small sized.
Make the font normal sized.
Make the font big sized.
Make the font huge sized.
Just throw any old unicode into martex and it will work. You can also use these escape codes:
Command | Result | Command | Result | |
\& | & | \"AaEeIiOoUuy | ÄäËëÏïÖöÜüÿ | |
\% | % | \'AaEeIiOoUuZ | ÁáÉéÍíÓóÚúŹ | |
\$ | $ | \`AaEeIiOoUu | ÀàÈèÌìÒòÙù | |
\copy | © | \^AaEeIiOoUu | ÂâÊêÎîÔôÛû | |
\> | > | \^AaEeIiOoUu | ÂâÊêÎîÔôÛû | |
\< | < | \~AaIiOoNnUu | ÃãĨĩÕõÑñŨũ | |
\} | } | \.AaUu | ÅåŮů | |
\{ | { | \-Oo | Øø | |
\cdot | · | \ss | ß | |
\pm | ± | \func | ƒ | |
\tm | ™ | \reg | ® | |
\euro | € | \Alpha\alpha | Αα | |
\pound | £ | \Beta\beta | Ββ | |
\deg | ° | ... | ||
\backslash | \ | \Omega\omega | Ωω | |
\L\l | Łł |
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 }.
Use to display an image.
Use to display text under your image.
Use to give your image a label, so you can use \ref{label} to reference it.
Set the width of your image. Width can have the following formats: 10 (this is a percentage), 10px, 10cm, 10em.
Set the height of your image. Height can have the following formats: 10 (this is a percentage), 10px, 10cm, 10em.
Set the alt text, also called hovertext, of your image.
\begin{figure}
\includegraphics{test.png}
\caption{This is a test image}
\label{testimage}
\width{120px}
\height{30}
\alttext{A mouse!}
\end{figure}
Note that there are two different list environments: enumerate and itemize with a different default markers, respectively numbers and bullets.
Mark the start of the next item in the list.
Set the marker type. Valid types are: square, bullet, circle, none, numbers, letters, LETTERS, roman, ROMAN.
Code | Rendered |
|
|
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.
Add a horizontal line at this position in the table. Maximum of two lines per row.
Make a cell span over N columns. You can add special formatting to this cell (so just like your table formatting).
Make a cell span over N rows
\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}
\begin{paragraph}
Paragraph text
\end{paragraph}
Paragraph text
You can center text:
\begin{center}
Center text
\end{center}
Hide and show text using details.
\begin{details}[Summary]
Details text
\end{details}
Summary
Details text
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.
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.
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.
This project is licensed under the MIT License - see the LICENCE.md file for details