#7 pandoc support


please add support for http://johnmacfarlane.net/pandoc/ to markdown, since it is a very convenient lot of additions.
Maybe some other extensions could be added, but I am not familiar with the other so that I can only recomment Pandoc's one.
Note: There is already a pandoc wrapper for python by Kenneth Reitz: https://github.com/kennethreitz/pyandoc


    • labels: enhancement, pandoc, extras, syntax --> pandoc, syntax
    • status: open --> accepted
    • milestone: 1.0 --> 1.0-updates
  • ReText uses 2 Markdown extensions by default: footnotes and tables, but I will maybe add an option to customize this. I think this will suit you.

    If you mean Pandoc's converter, so I've tested it and I think it doesn't work well. However, you can still use it via it's command-line tool (pandoc -t markdown -o output.re input.odt).

  • With the latest Git version, you are able to define extensions in the config file.

    Just append a line like mdExtensions=tables, footnotes to ~/.config/ReText project/ReText.conf file.

    List of available extensions.

    Can I close this bug?

    Last edit: Dmitry Shachnev 2011-05-03
  • codronm

    Hi Dmitry,

    Thanks for the efforts you put in these improvements.
    In fact, my request was about adding a way to use pandoc's converter when it is installed (via an option) since it adds
    - some extensions to syntax
    - a lot of outputs

    anyway, you say it doesnt work very well... could you please be a bit more precise since I used it fr a while and have been satisfacted with it (maybe you found that the python wrapper was not a good implementation?)

    • Ok, if you mean the converter, I will add support in the 1.1 release.
      Do you need import, export or both?

      • codronm

        I think that in ReText, using pandoc as export engine is sufficient.
        My idea is that it can then offer to the user ( myself, in this case ;) ) the satisfaction of using the syntax he already knowns; and more of this, it can use templates and so on provided by pandoc's engine.
        Again, thanks for your concerns regarding this feature request.

    • I give pandoc converter a test today, here's what I got:

      • I can't open the .rtf file it generated in LibreOffice or WordPad
      • HTML tags are splitted:

        >Here is some example <em
          > text.</p
      • It removes all HTML-tags style from Markdown document

      • It adds many blank lines to the end of the document
      • It doesn't support python-markdown extensions

      Also, the most popular of supported formats are already included in ReText (PDF, ODT, HTML), and it doesn't support some popular formats (such as .docx).

      I'm not really satisfied with its quality :(. But this does not mean that I won't implement the support, I'll take another look at pandoc later.

      Last edit: Dmitry Shachnev 2011-05-07
      • codronm

        Thanks for at least trying.

        I'm just a bit surprised since for example splitted tags has been solved in recent build, and I have generated RTF / odt several times...(which version did you test?)

        When you speak about extension, I confirm that pandoc has added its own extensions to markdown syntax, sometimes (did I said too often?) in a different way than other markdown extensions (the explanation is that pandoc tries to add a lot of output formats, and some concepts taht are easy to implement in a markdown to html conversion can be more tricky when it comes to more exotic formats).

        But I would understand if you decide to have a break on pandoc integration, since you are right: retex already implements a lot of formats

        At least, I am not a python dev at all, so i can not help... maybe the lazy (but sufficient for the use I imagine) solution would be that you offer a way to specify system commands for each conversion retext offers... that way, if someone wants to have pandoc as a background, he only have to customize these commands, maybe by writing some shell...

        • Just re-tested with pandoc 1.6-1 from Debian experimental.

          RTFs still can't be opened (they don't have a header like {\rtf1\ansi\...}),
          tags are still broken.

          Which version do you use (or I'm just unlucky)? (I don't use the Python
          wrapper, so it's not its fault).

          Anyway, I like the idea of "export extensions" you suggested, this can
          be easily done using QSettings file (which is in ~/.config/ReText project/ReText.conf on Linux), it will definitely be in ReText 1.1 (however
          I'm not sure if a GUI is neccesary).

          Last edit: Dmitry Shachnev 2011-05-08
          • codronm

            about the version, I know that debian (and ubuntu) have really obsolete packages... current version is, and it have to be installed via cabal (haskell package manager): http://johnmacfarlane.net/pandoc/installing.html.

            about "export extensions" (I like the way you named it :) ), I do not think it really need a gui (but I should it is more important to have a clear doc about it) since it is an advanced usage, and the linux philosophy tends to keep advanced configurations in config files.

            The only gui I could imagine would be an export profile chooser:
            You define profiles in the QSettings file (a profile defines the commands to be used for each format), and ReText is installed with a default profile corresponding to current tools, and then, creating profiles is a work for advanced users when using profiles is as easy as choosing an item in a combobox...

            The single drawback I can see is that some tools can extend markdown syntax (like pandoc does) and I do not know if profile can define these syntax extensions (this is a drawback only if you plan to add syntax highlighting / helpers)

            • ReText uses python-markdown which supports only it's own extensions (i have given a link above), so it can't use pandoc's extension (but you can find a good replacement for it).

              // Version in Ubuntu is 1.5, I used the version from Debian experimental. They are really slow :)

  • Fixed in Git.

    To use this feature, you need to add a section "Export" to your config file like this:

    rtf=/usr/bin/pandoc -f markdown -t rtf -o %of %if
    docbook=/usr/bin/pandoc -f markdown -t docbook -o %of %if

    where %of and %if will be replaced with input and output filenames at runtime.

    Then you can access this feature via "Export > Other formats". Note: format name should be the same as the extension, since it's appended to the filename.

    // I can't place it into the main "Export" menu due to technical restrictions.

    Last edit: Dmitry Shachnev 2011-05-11
    • status: accepted --> closed
    • assigned_to: Dmitry Shachnev
    • milestone: 1.1 --> 1.0-updates
  • codronm


    I'll try to give it a try, but I do not have so much time in the upcoming days...
    So I do not promise to give feedback quickly



Cancel   Add attachments