phyllisstein / Pandown

A powerful, versatile, highly Subliminal Pandoc build wrapper for ST2/3
64 stars 12 forks source link

Add support for --toc-depth #7

Closed jgsw closed 11 years ago

jgsw commented 11 years ago

There doesn't currently seem to be a way of setting --toc-depth as one of the command_line arguments -- would it be possible to add this?

James

phyllisstein commented 11 years ago

I've added it to the configuration files in the latest commit—sorry for the oversight! However, if you'd like, you can also add it on your own until Package Control picks up on the change. Just add this to your pandoc-config.json or Pandown.sublime-settings file:

"command_arguments":
{
    // ...
    "toc-depth": 3,
    // ...
}

The package should pick up on it if you do that. In the new files, it's set to false by default, so it'll use Pandoc's default (=3), but can be changed to any integer.

jgsw commented 11 years ago

Thanks very much for this quick reply. Setting toc-depth to 2, 3 4 or 5 (or false) works as expected. But setting toc-depth to 1 generates an error, namely "pandoc: TOC level must be a number between 1 and 6". On looking at the console, it looks like the problem is that Pandoc is being passed --toc-depth without a parameter.

I think the problem must be in the code Pandown's using to parse the the settings file, as setting base-header-level to 1 generates a similar error. I discovered that a workaround is to enclose the 1 in quotation marks.

phyllisstein commented 11 years ago

Aha, I see. That's because True is technically equal to 1. It was throwing off the selection logic. Let me rejigger that a bit and see if I can't get it working right.