tbfisher / sublimetext-Pandoc

A Sublime Text plugin that uses Pandoc to convert text from one markup format into another. Pandoc can convert documents in markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, OPML, or Haddock markup to XHTML, HTML5, HTML slide shows using Slidy, reveal.js, Slideous, S5, or DZSlides, Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML, EPUB version 2 or 3, FictionBook2, DocBook, GNU TexInfo, Groff man pages, Haddock markup, OPML, LaTeX, ConTeXt, LaTeX Beamer slides, PDF via LaTeX, Markdown, reStructuredText, AsciiDoc, MediaWiki markup, Emacs Org-Mode, Textile, or custom writers can be written in lua.
MIT License
137 stars 26 forks source link

Could you open converted output into new buffer (instead of current)? #2

Closed mbacou closed 11 years ago

mbacou commented 11 years ago

Many thanks for making Pandoc available in ST2. I'm no Python coder, but would like to modify the package to open the converted output into a new buffer (instead of overriding the current one). Could that be added as an option? Also could PDF be added as an output format for those of us who have Latex installed locally?

These would be very nice enhancements.

Thanks, --Mel.

tbfisher commented 11 years ago

Committed, thanks! You can revert to previous behavior by editing the plug-in settings.

tbfisher commented 11 years ago

re-opening since requested PDF output option not implemented

jsadeli commented 11 years ago

Hmm.. interesting... it appears that python's (or sublime text's) environment PATH is different than that of the system.

I'm testing the PDF output and the command is legit:

DBG: ['/usr/local/bin/pandoc', '-o', u'/var/folders/3p/g1840z9s3k1g42hrvctvzqnw0000gn/T/tmpC_vGim.pdf']

but that command is giving me pandoc: pdflatex not found. pdflatex is needed for pdf output error. That symptom appears probably because /usr/texbin isn't defined in python's (or sublime text's) PATH.

Any ideas?

jsadeli commented 11 years ago

Hoooray! Black magic works!

tbfisher commented 11 years ago

Thanks! I modified it a bit, so that you just have to use the settings file to set --latex-engine

I don't have latex installed, to test, can you verify this works?

jsadeli commented 11 years ago

The subprocess command is broken (causing an error):

['/usr/local/bin/pandoc', u'-', u'-', u'l', u'a', u't', u'e', u'x', u'-', u'e', u'n', u'g', u'i', u'n', u'e', u'=', u'p', u'd', u'f', u'l', u'a', u't', u'e', u'x', '-o', u'/var/folders/3p/g1840z9s3k1g42hrvctvzqnw0000gn/T/tmp1vmA3J.pdf', '-f', u'markdown']

And for the user settings, I can't specify the PDF format argument like this (since it will remove all the other formats):

{
  "formats": {
    "PDF": {
      "pandoc": "pdf",
      "to": "--latex-engine=/usr/texbin/pdflatex"
    }
  },
}

I'll need to copy-paste the entire default settings into user settings just to modify that one param.

tbfisher commented 11 years ago

oh crap that's so unfortunate. I will have to change the settings format to make user settings more sane.

I fixed the default pdf output settings for the mac, works for me with BasicTeX installed.

jsadeli commented 11 years ago

Also works with MacTeX 2012. :+1: