Sublime Text 3?

's Avatar

pitosalas

01 Jul, 2013 07:31 PM

I'd like to auto launch marked by saving a file in Sublime Text 3 - without having to do a file open in Marked each time. Can you tell me how?

  1. Support Staff 1 Posted by Brett on 01 Jul, 2013 07:53 PM

    Brett's Avatar

    You can set up a Build System for Markdown files like this: http://doingthatwrong.com/home/2012/5/21/launching-marked-from-sublime-text-2.html

    There's a ready-to-go one in the Bonus Pack: http://support.markedapp.com/kb/how-to-tips-and-tricks/marked-bonus-pack-scripts-commands-and-bundles

    You can also add it to the Sublime Text menu with a package (available through Package Manager as well): https://github.com/jocelynmallon/sublime-text-2-marked

    -Brett

  2. 2 Posted by pitosalas on 01 Jul, 2013 07:58 PM

    pitosalas's Avatar

    Hi Brett

    I thought it had to do with Sublime Text but, Marked seems to be crashing
    each time I run it and open a file. It crashes hard, every time. Can you
    help? I reinstalled from App store and that didn't help!

    -- Pito

  3. Support Staff 3 Posted by Brett on 01 Jul, 2013 08:05 PM

    Brett's Avatar

    If you've altered your system Ruby install, that may be the culprit. If so (or if you're not sure), see this discussion: http://support.markedapp.com/discussions/problems/3285-marked-crashed-when-i-try-to-open-md-or-mdown

    Otherwise, please send a crash report from Console.app and a sample file that you're trying to open.

    Thanks,
    Brett

  4. 4 Posted by pitosalas on 01 Jul, 2013 08:12 PM

    pitosalas's Avatar

    Hi Brett

    Thanks, that might be it. Does Marked assume that ruby is found at a
    specific place, /usr/bin/ruby ??

    Because on my system, due to using rbenv, the console says this:

    ~> ls /usr/bin/ruby
    ls: /usr/bin/ruby: No such file or directory
    ~> which ruby
    /Users/pitosalas/.rbenv/shims/ruby
    ~> ruby -v
    ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-darwin12.3.0]
    ~>

    What's the 'clean' way to handle my case?

    Thanks,

    Pito

  5. Support Staff 5 Posted by Brett on 01 Jul, 2013 08:24 PM

    Brett's Avatar

    Link your ruby to /usr/bin/ruby (that's where Marked 1.4 expects it).

    ln -s /Users/pitosalas/.rbenv/shims/ruby /usr/bin/ruby

    p.s. This issue will be resolved in the next major release by a) reducing dependency on Ruby, b) searching for Ruby in System/Frameworks and c) providing better error catching if the binary isn't found.

  6. 6 Posted by pitosalas on 02 Jul, 2013 01:36 PM

    pitosalas's Avatar

    Thanks!

  7. 7 Posted by jonathan on 19 Oct, 2013 04:23 PM

    jonathan's Avatar

    Neither of the second two options in the original answer work for me in ST3. I've added a github issue to https://github.com/jocelynmallon/sublime-text-2-marked.

    The Bonus Pack details are all about ST2 not ST3.

    Thankfully the first option let me work it out, though again it's different for ST3 that written. The .build-system is

    {
        "shell_cmd": "open -a marked \"$file\""
    }
    
  8. 8 Posted by david.payne.pac on 21 Nov, 2014 12:33 AM

    david.payne.pac's Avatar

    Just to update... for building with Marked 2 via ST3 it should now be...

    {
        "shell_cmd": "open -a 'marked 2' \"$file\""
    }
    
  9. 9 Posted by Duncan McKenzie on 18 Mar, 2015 03:52 PM

    Duncan McKenzie's Avatar

    As someone who has never set up a build system in Sublime Text, I was confused by the instructions given. It's one of those (many) things that's simple if you know how, but it took me about an hour of trawling the internet for different sets of instructions.

    For others in my boat, here are step by step instructions to make Sublime Text 3 preview documents in Marked 2.

    Assuming Marked 2 is installed, everything is done inside Sublime Text 3.

    In Sublime Text 3, click on:
    Tools > Build System > New Build System

    You'll be presented with a blank document containing the following text:

    {
    "shell_cmd": "make"
    }

    Replace the text with this:

    {
        "shell_cmd": "open -a 'marked 2' \"$file\""
    }

    Save the file. You'll be prompted for a filename - the default is untitled.sublime-build - change "untitled" to Marked2

    This adds the option to use Marked 2 to Sublime Text 3's build options. (As far as I could see, no restart was required.)

    Now click Tools>Build System and change your default Build System to Marked2, which should now be listed at the bottom.

    After that, pressing Command-B (or clicking Tools>Build) should automatically open the current document in Marked 2.

  10. 10 Posted by Keith Dvorak on 11 Jun, 2019 01:43 PM

    Keith Dvorak's Avatar

    Thank you, Duncan!

    As addendum to Duncan's instructions, you have to save the file before you build it. I had a test file I created and Duncan's instructions "weren't working." When I got an error message from Marked2 that there was no file for it to display, I tried saving the test file. BAM! Worked like a charm!

    On behalf of MultiMarkdown writers who aren't developers, thank you, Duncan!

  11. Support Staff 11 Posted by Brett on 11 Jun, 2019 02:41 PM

    Brett's Avatar

    Keith: You can also use a package to run the build system automatically
    whenever you save: https://packagecontrol.io/packages/SublimeOnSaveBuild

    I'm pretty sure I have a preference set that saves all open files when
    running Build, but a quick scan didn't turn it up for me.

    - Brett

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac