For converting Texy files to HTML or GitHub Markdown via command line.
For converting Texy files to HTML or GitHub Markdown via command line. It can also be used as a library in your project and you can call converters directly.
If you are converting to HTML, you can provide Latte template that will be filled.
Use composer to install TestIt. Just add arron/cli-texy-converter project as your dependency.
convert texy [-t|--template="..."] [-f|--force] from to
- from is source texy file
- to is target file that will be created. What conversion will be used is determined according to the extension of the target file (.html and .htm for conversion to HTML, .md for conversion to Markdown).
- -f or --force is option to force rewrite target file if already exists. Without this option the exception will be thrown when trying to overwrite existing file.
- -t|--template="..." is path to Latte template. If provided, the result of conversion will be passed to this template via
There are two classes. One for conversion to HTML and one for conversion to Markdown. Both classes is implementing
and usage is really straight forward.
$htmlConverter = new HtmlConverter(); $resultString = $htmlConverter->convert($sourceString); $markdownConverter = new MarkdownConverter(); $resultString = $markdownConverter->convert($sourceString);
There are no possibility to change some of the options so far.
Texy is converted to the GitHub Markdown syntax. The conversion is done through Texy parser and ouput is changed to not to convert to HTML but to Markdown. Due to this solution there are several limitations. Texy doesn't provide all of the necessary customizations so these parts are reamaining unchanged in the ouput due to this:
Some Texy features are not supported in GitHub Markdown language:
- acronyms: Texy syntax NATO((North Atlantic Treaty Organisation)) is simply converted to NATO (North Atlantic Treaty Organisation).
- inline quoting: Texy syntax >>inline quote<< is left unchanged.
- Texy syntax ++inserted++ --deleted-- ^^superscript^^ m^2 alternative superscript subscript m_2 alternative subscript is converted as
deletedsuperscript m2 alternative superscript subscript m2 alternative subscript
Feel free to use it under the GPL license of under GPL v2 or any later version of GPL.