ezuk
ezuk

Reputation: 3196

Sublime text: Process current buffer with Ruby script?

I have a Ruby script that can take a Markdown file and transform it to an output format I need.

I usually write these Markdown files using Sublime. I am looking for a simple way to run that particular Ruby script on the current buffer.

I was looking at build systems but that seems incredibly complicated for what I need. Also, the problem is that the actual command I am running is "ruby" and it has two arguments:

ruby process_markdown.rb (current_file).md

And the "process_markdown.rb" file is in the Packages/User folder.

So... am I supposed to use a Build System for this? Or is there a simpler way? If build system, could you point me in the right direction?

Many thanks in advance.

Upvotes: 2

Views: 145

Answers (1)

AGS
AGS

Reputation: 14498

I would try to write a .sublime-build for your Markdown files.

Something like

{
  "cmd": ["/full/path/to/ruby/ /full/path/to/process_markdown.rb", "$file"],
  "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
  "selector": "source.md"
}

Upvotes: 2

Related Questions