1

There is an excellent package to preview markdown written using sublime text. I wanted to know how I might modify it, or perhaps use it as the basis for writing one that could process multi-markdown.

I'm using Linux (Ubuntu) and I'm currently calling multimarkdown in the terminal on each file.

One of the issues I think I might face is that multimarkdown refuses to parse an open file for some reason.

Any thoughts on how I might begin this or if an alternative solution exists would be very gratefully received.

Tahnoon Pasha
  • 5,848
  • 14
  • 49
  • 75

2 Answers2

1

There is a MultiMarkdown option in the syntax list - View > Syntax > Markdown > MultiMarkdown. Isn't that working? By the way the syntax (and almost any other) files are in packages folder of Sublime Text 2. This is the syntax file:

/Users/[username]/Library/Application Support/Sublime Text 2/Packages/Markdown/Markdown.tmLanguage

And MultiMarkdown file is in the same directory.

Taylan
  • 3,045
  • 3
  • 28
  • 38
  • Hi @T-- thanks for looking at this. The syntax highlighting works, but preview mode doesn't. Neither does "build" ~ so if I do a custom build with multimarkdown it balks, saying "cannot parse" since the document is open. – Tahnoon Pasha Jul 22 '13 at 06:42
  • Assuming the package you mentioned is Markdown Preview you can edit files in it's directory (probably markdown2.py or MarkdownPreview.py). I don't know what you should change in there but the files you are looking for are those. And don't forget to disable Package Control update for Markdown Preview if you are using one. In Package Control settings there is auto_upgrade_ignore option. That is your guy. – Taylan Jul 22 '13 at 07:12
  • Thanks @T--. It looks like the only sensible way to edit it would be to re-write a multimarkdown parser in python similar to the markdown2.py parser and then replace that in MarkdownPreview.py. That is way outside my skill level at the moment, but it sounds like the right answer in any case. Thanks for your help. – Tahnoon Pasha Jul 22 '13 at 09:30
1

I'm intrigued by your statement that "multimarkdown refuses to parse an open file". Can you provide more information, or email me, or open an issue on github? MultiMarkdown doesn't check to see whether a file is open or not --- it simply reads the file and processes it. So if there's a problem, then the OS is not allowing MMD to proceed for some reason...

I don't have Sublime Text installed on Ubuntu (I generally use a command line only version of Ubuntu for testing MMD), so I can't test this situation exactly. I haven't had any other reports of difficulties parsing files (open or not). I don't have any trouble with Sublime Text 2 on Mac OS X and MMD.

As an alternative, you could try using one of the support scripts (e.g. mmd if you want MMD->HTML) and see if that has the same problem with open files.

PS> Are you using the latest build of MultiMarkdown, e.g. 4.2+?? (Though it shouldn't change anything related to open files)

  • Hi @Fletcher. Thanks for a great piece of code. I checked and the MMD where the problem occurred was 3.7. I used 4.2 on another machine and couldn't replicate the error. When I went back to the 3.7 machine I couldnt seem to replicate it either. What happened was that while editing a .md file in sublimeText I tried `multimarkdown myfile.md > myfile.html` and received the error `multimarkdown cannot parse this file`. Couldn't figure out how to get verbose output. If it happens again I'll post on github. – Tahnoon Pasha Jul 24 '13 at 01:57