Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to avoid the popup every use? Or set a hotkey? #60

Open
AnnanFay opened this issue Mar 23, 2017 · 2 comments
Open

How to avoid the popup every use? Or set a hotkey? #60

AnnanFay opened this issue Mar 23, 2017 · 2 comments
Labels
enhancement good first issue Help out here if you have some time on your hands!

Comments

@AnnanFay
Copy link

Hello,

Right now I'm using this to convert markdown to PDF. This is the only way I'm using this.

Is there a way to avoid the dropdown option every time? As I want to convert to PDF every time I use this.

Also, is there a way I can link this into the build system? So I can just click Ctrl+B when editing markdown and auto generate the PDF?

Maybe I'm using this extension incorrectly or there's an alternative. I've had a quick look at the settings file and couldn't find an option.

I've tried setting up a hotkey:

{ "keys": ["ctrl+shift+b"], "command": "pandoc", "args": {"transformation": "PDF"}},

However this fails with:

Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 812, in run_
    return self.run(edit, **args)
  File "Pandoc in /home/_/.config/sublime-text-3/Installed Packages/Pandoc.sublime-package", line 103, in run
TypeError: string indices must be integers
@pchtsp
Copy link

pchtsp commented Oct 26, 2017

I've been trying to do this too.
If you use the following configuration, you'll have the shortcut but it will still show the prompt;

	{ 
		"keys": ["ctrl+shift+k"],"command": "prompt_pandoc"
	},

I think in order to be able to give it the text argument with the name of the transformation, some modifications need to be done in the code or another function would need to be created because the transformation argument in the run function that is being called is in fact a dictionary.

While writing this answer, and based on your example, I figure out you can actually do this in a "not-so-pretty" way by giving explicitly the dictionary with the settings as the argument. I use html syntax but you would just have to copy your pdf settings here:

{ 
    //"keys": ["ctrl+shift+k"],"command": "prompt_pandoc"
    "keys": ["ctrl+shift+k"],
    "command": "pandoc",
    "args": 
    {
    "transformation":
        {
        "new-buffer": 1,
        "scope": {
          "text.html.markdown": "markdown",
          "text.html": "html",
        },
        "out-ext": "html",
        "pandoc-arguments": [
          "--to=html5",
          "--no-highlight",
          "--output=output.html",
          "--self-contained",
          "--standalone"
        ]
        }
    }
},

@MPvHarmelen
Copy link
Collaborator

I would also love to be able to do this. It seems like there's a fork that has solved this problem: https://github.com/geniusupgrader/Spandoc, maybe someone could look into how much work it is to port their solution?

It seems quite easy, this is the commit:
https://github.com/geniusupgrader/Spandoc/commit/438abafc8bb99d0cda96538875b8685cd1bb029f

@MPvHarmelen MPvHarmelen added enhancement good first issue Help out here if you have some time on your hands! labels May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue Help out here if you have some time on your hands!
Projects
None yet
Development

No branches or pull requests

3 participants