z--
z--

Reputation: 2236

Is there a LiveCode external for the pandoc converter?

Is there an external (plugin) which wraps the pandoc http://johnmacfarlane.net/pandoc/ document converter? I would like to run the content of a LiveCode field through pandoc and get the result back in a LiveCode variable/field. A prominent use of pandoc is to convert markdown to HTML. Maybe there is such a converter implemented in LiveCode?

A list of markdown implementations: https://github.com/markdown/markdown.github.com/wiki/Implementations

Upvotes: 0

Views: 266

Answers (2)

Monte Goulding
Monte Goulding

Reputation: 2420

It's unclear from your question if you actually only need markdown to html. If that's all you need then check out https://github.com/montegoulding/mergMarkdown

Upvotes: 1

hliljegren
hliljegren

Reputation: 436

Trevor DeVore Has a GitHub repository of a markdown library at https://gist.github.com/trevordevore/5090459

As pandoc is a command line utility you should be able to call it via:

shell("pandoc -f markdown -t html yourinputfile")

And if you want to wrap that into a function it should be possible to do something like

function markDown2HTML pMarkDown pFromFormat pToFormat
   put specialFolderPath("temporary") & "/pandocConvert" & the seconds into tTmpFile
   put pMarkdown into URL "file:" & tTempFile
   put shell("pandoc -f" && pFromFormat && "-t" && pToFormat" && tTempFile) into tHTML
   delete file tTempFile
   return tHTML
end markDown2HTML

Note: This is written out of my head and not tested with an actual pandoc installation.

Upvotes: 0

Related Questions