0

Is there a stable Markdown library that can be used on Flash TextField objects's htmlText properties?

There is this one that was recommended in a similar question: ActionScript library to convert Markdown to HTML

But doesn't seem to work even if I embed the bold, italic, italic+bold versions of the font (ex: Arial). Plus it seems to leave a bunch of blank lines in between each lines of text.

I'm basically testing it out with this string:

Vanilla Muffin
============

Ingredients:
--------------

- 1 tbsp. **Vanilla** extract
- Muffin**mix**

Directions:

- Mix vanilla with muffin mix.
- place in a muffin pan.
- Bake it!

TADA!

Know of any good Markdown port to AS3?

EDIT: Stackoverflow's formatting seems to apply color to the markdown example above, that should be plain text (just so you know).

chamberlainpi
  • 4,854
  • 8
  • 32
  • 63

1 Answers1

1

I didn't find anything like you want for AS3, however there are two libraries in Haxe which you can use as a base for creating your own:

https://github.com/jasononeil/mdown (This one works in Haxe 2.x)

https://github.com/dpeek/haxe-markdown (This one works with Haxe 3.x)

While not in the same language, Haxe has a sintax very similar to AS3, which makes it easy enough to port / understand and apply to your specific case.

EDIT: If you need to create a SWC to use with Flash Professional, take a look at this question, which links to a repository with examples on how to do it (compatible with Haxe 3.x):

Can we use compiled HAXE swf's swc's in Actionscript as normal libs?

Hope this helps!

Community
  • 1
  • 1
TiagoLing
  • 131
  • 3
  • Hey @TiagoLing, I gave haxe-markdown a try (compiled a SWC to try adding it to the Flash Pro IDE publish settings). Doesn't seem to be that easy to get it working. Maybe I'm just initializing the Haxe lib incorrectly at the start (might be different from Haxe 2 to 3) – chamberlainpi Sep 29 '14 at 16:49
  • 1
    To be honest, i never used haxe libraries compiled directly to swc to use with Flash. There might be code that cannot be directly translated, or even problems during the swc generation. The safest way i think would be to port it to AS3. Also, another route would be to just check the source code and try to implement a minimal version based on the parser itself (i.e. how the library treats and identifies each line of the string with markdown). – TiagoLing Sep 29 '14 at 16:53