0

I'm trying to write a Sublime-Text-3 build system that will run Pandoc to convert my markdown file to html, and then open the html in my browser. I keep getting a "No Build System" error, and I can't figure out why...

Here's my build config file:

// Markdown.sublime-build
{
  "selector": "text.html.markdown",
  "working_dir": "$file_path",
  "shell_cmd": [
    "pandoc",
    "-f", "markdown",
    "-t", "html",
    "-o", "${file/\.md/\.html/}",
    "$file"
  ],
  "shell_cmd": ["open", "${file/\.md/\.html/}"]
}

I'm running Mac OS X 10.11. I've read the Unofficial Documentation.

  • What's the output in the console? Did you try and specify the build system, rather than using "Automatic"? – idleberg May 10 '16 at 10:10
  • I did try that. It was the syntax, like you mentioned in your answer. – Fried Brice May 10 '16 at 15:36
0
  1. Your build file is invalid JSON, which is likely causing the error message. Sublime Text is forgiving about the use of comments, but you will have to escape those back-slashes.

  2. Since pandoc is not a shell command, you need to use "cmd" instead of "shell_cmd". A shell command would be ls, mkdir etc.

Valid JSON:

{
  "selector": "text.html.markdown",
  "working_dir": "$file_path",
  "cmd": [
    "pandoc",
    "-f", "markdown",
    "-t", "html",
    "-o", "${file/\\.md/\\.html/}",
    "$file"
    "&&",
    "open",
    "${file/\\.md/\\.html/}"
  ]
}

As an alternative, you could always use the Pandoc package for Sublime Text.

  • Thank you. That fixes the "No Build System" error. I still have trouble sequencing the two cmds. A little research seems to indicate that Sublime-Text-3 doesn't support multiple cmd declarations in a build config file, so I'll have to write a shell script and have my build config call that shell script. Thanks very much for your help. – Fried Brice May 10 '16 at 15:35
  • I had no trouble with her hat either, but the edited version should work as well! – idleberg May 10 '16 at 19:14
0
{
    "cmd": ["pandoc -o \"$file_base_name.html\" \"$file\" && open  \"$file_base_name.html\""],
    "shell": "true"
}

works for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.