Sublime Forum

Pandoc build system

#1

I can use Pandoc on the commandline to convert .md files to .html but I would like to have a build system for this.

My attempt at a build system is as follows:

	"cmd": "pandoc", "-S -s -f markdown -t html -o $file_base_name.html $file"],
	"source": "md"

This works but it ignores the “-S -s” options and I can’t figure out why.

I have had similar problems setting up multimarkdown and textile, which means I am doing something silly, but I can’t figure out what it is.

I have also looked at the “Pandoc (Markdown)” package which is available through Package Control, but it fails to find a “template.html”.

Any help would be much appreciated.

Alex

0 Likes

#2

You need to pass arguments as separate strings, rather than as a single space separated string

0 Likes

#3

Thanks for the quick answer. I should have found the docs at: sublimetext.info/docs/en/core/build_systems.html

Now I’ve encountered this:

Running Q:\APPS\Pandoc\bin\pandoc.exe -S -s -f markdown -t html -o C:\EN2305-C-4.md.html C:\EN2305-C-4.md
Traceback (most recent call last):
  File ".\sublime_plugin.py", line 325, in run_
  File ".\exec.py", line 145, in run
TypeError: __init__() got an unexpected keyword argument 'source'

I’ve tried to be as explicit as possible and have kept the paths simple because pandoc was choking up.

Any ideas on what’s causing the error?

I may be missing something very obvious, because I am giddy at the fact that it was Jon that replied.

(I am using build 2178, if that makes any difference.)

0 Likes

#4

FWIK, there’s no “source” parameter for the buld command.
Do you mean “selector” ?

Like you already said, look at the doc and the existing build system files.

0 Likes

#5

Thank you bizoo!

The following seems to work:

	"cmd": "pandoc", "-S", "-s", "-f", "markdown", "-t", "html", "-o", "$file_base_name.html", "$file_name"],
	"selector": "text.html.markdown"
0 Likes