J2M icon indicating copy to clipboard operation
J2M copied to clipboard

Use Pandoc for Textile <> MD and add JIRA's extras

Open FokkeZB opened this issue 8 years ago • 2 comments

http://pandoc.org/ http://pandoc.org/try/ https://answers.atlassian.com/questions/31681034/how-different-is-jira-markup-from-textile

FokkeZB avatar Jun 16 '16 07:06 FokkeZB

Note that Pandoc is a Haskell library that also provides a command-line tool, while this project, J2M, is a JavaScript library. That would make it difficult to call Pandoc from J2M unless this tool were changed to be a command-line tool or to have a separate server component that ran Pandoc.

It is possible to embed Pandoc in the browser: http://markup.rocks/ (source code) does it by compiling the Haskell to JavaScript using GHCJS. However, this involves a 2.2 MB initial download of the generated JavaScript.

So these are the options for improving the parsing:

  • require local installation of J2M and Pandoc, and get rid of the website component
  • add a server-side component that runs Pandoc, and host it on the web along with http://j2m.fokkezb.nl/
  • embed Pandoc as a library, the way markup.rocks does it
  • give up on integrating Pandoc; write custom conversion code on top of existing Markdown and Textile parsing libraries for JavaScript

To give more detail on the non-Pandoc option, there are existing libraries that can parse and generate Markdown (CommonMark), and that can at least parse Textile (textile.js). They each have their own AST format which you could use as J2M’s internal standard representation. Or you could convert both Markdown and JIRA to HTML before converting them to the other format. Whether you use Pandoc or a native JavaScript library to parse Textile, you would still first have to write code to convert between Textile and JIRA markup, in both directions.

roryokane avatar Mar 30 '17 23:03 roryokane

There might be some Node.js wrappers: https://www.npmjs.com/search?q=pandoc

Anyway, if you want to give it a go, be my guest! Unfortunately I personally don't have time for it atm.

FokkeZB avatar Mar 31 '17 18:03 FokkeZB