revolunet / sublimetext-markdown-preview

markdown preview and build plugin for sublime text 2/3
MIT License
2.31k stars 362 forks source link

Specify build output path #193

Closed DannyT closed 10 years ago

DannyT commented 10 years ago

Is there anyway to specify a path for the build system to output to? Currently when I Ctrl + B the html files end up in the current folder, I'd like this to be in a /build/ subfolder.

I notice I can preview in such a folder but that uses temporary filenames, would be good to have original filenames.

Is this possible?

revolunet commented 10 years ago

The path_tempfile helps you specify the output dir but you're right, the filename is generated.

Some should add an option for the filename and modify the function in : https://github.com/revolunet/sublimetext-markdown-preview/blob/master/MarkdownPreview.py#L46

There's been an attempt but it needs an update : https://github.com/revolunet/sublimetext-markdown-preview/pull/99

facelessuser commented 10 years ago

@DannyT, Markdown Preview can now utilize YAML frontmatter to specify a save path for when using Ctrl+B.

Just add this as the very first thing in your markdown file:

---
destination: /my/save/path/file.html
---

You can use relative paths, just read the readme to get more details on how all of that works https://github.com/revolunet/sublimetext-markdown-preview#yaml-frontmatter-support

This is per file, so you should be able to specify specifically what you want that file name to be and where you want it to go. I think between the YAML frontmatter support and path_tempfile, you should have plenty of options to get exactly what you need.

Let me know if this fills your needs so we can close this issue. Issue #99 will be left open until someone finishes that feature.

facelessuser commented 10 years ago

@DannyT, Please do comment on this potential resolution. I plan on closing this issue at the end of the week.

DannyT commented 10 years ago

Hi @facelessuser I did give this a quick look but adding that at the top of the file just rendered into the file itself on Ctrl + B, was there anything else I was supposed to do?

facelessuser commented 10 years ago

Did you enable YAML support https://github.com/revolunet/sublimetext-markdown-preview#yaml-frontmatter-support?

DannyT commented 10 years ago

Nope that was the missing bit I needed, works fine now thanks :)