Extends the Haxe Markdown library to support the htmlText
property of OpenFL's TextField
class. A very limited subset of HTML is supported by TextField
, so the normal HTML generated by Markdown needs to be simplified.
Run the following command in a terminal.
haxelib install markdown-openfl-textfield
Then, add the following line to your OpenFL project.xml file.
<haxelib name="markdown-openfl-textfield" />
The following example displays Markdown in an openfl.text.TextField
using its htmlText
property.
var rawMarkdown = "Hello, **world**!";
var htmlText = TextFieldMarkdown.markdownToHtml(rawText);
var textField = new TextField();
textField.htmlText = htmlText;
this.addChild(htmlText);