Home Download Buy Blog Forum Support

two easy markdown questions

two easy markdown questions

Postby dutch on Sat Jan 28, 2012 6:08 pm

OK, I'm new to both Sublime Text and Markdown. I'm a writer, not a programmer, but ST2 looks like a perfect match for the way I like to work. And I want to work using simple Markdown tags. A couple of noob questions:

1) What does VIEW > SYNTAX > MARKDOWN do for me that working in Plain Text view does not?

2) I see I have the option of saving files with one of the "markdown" file extentions. What are the advantages there? I mean as opposed to simply saving in txt format?

I know these are probably idiotic-seeming questions, but I'm green.

Thanks,
Dutch
dutch
 
Posts: 39
Joined: Fri Jan 27, 2012 3:25 pm

Re: two easy markdown questions

Postby C0D312 on Sat Jan 28, 2012 6:48 pm

By setting the Syntax to Markdown, you are telling Sublime Text what lanuage you are using to write in. This means, when you type *Markdown* tags, Sublime Text can _help_ you by coloring and autocompleting your text accordingly.

By saving the file with a markdown extension, you are telling any application that opens the file (Sublime Text included) that the text inside is written in markdown. That means the syntax will be set to Markdown and your tags and text will be colored, etc.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: two easy markdown questions

Postby dutch on Sat Jan 28, 2012 7:17 pm

Many thanks, C0D312. That all makes good sense. I'm working now with a very slightly modified version of the Monokai theme (I just changed a couple of colors). But it's not doing any Markdown-related coloring for me (even when I select that syntax and save in that format). What I'd really love is if the theme could throw a different background color behind heading lines-- i.e., if, say, a line with # heading 1 # could be one color, and lines with ## heading 2 ## could be a different color, and so on, through the different markdown heading levels. That would make the minimap fantastically useful to me. Are there themes that do that markdown coloring better than others? Theoretically, will every theme give me that kind of capability? Any pointers in that direction would be greatly appreciated.

D
dutch
 
Posts: 39
Joined: Fri Jan 27, 2012 3:25 pm

Re: two easy markdown questions

Postby C0D312 on Sat Jan 28, 2012 7:35 pm

Hmm. That's strange. I was pretty sure that monokai had Markdown support (cant check on that because I have it deleted from my computer). You see, tmThemes are completely responsible for the coloring of text. So if that particular tmTheme doesn't have support for a specific language, there won't be any coloring...

This is what my screen looks like with Syntax set to "Markdown"
Screen Shot 2012-01-28 at 2.27.42 PM.png
Screen Shot 2012-01-28 at 2.27.42 PM.png (25.72 KiB) Viewed 5558 times


I use a modified version of IR_Black (which I call "Refresh"), you can download it here: https://gist.github.com/1657493. It has support for Markdown.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: two easy markdown questions

Postby dutch on Sat Jan 28, 2012 7:44 pm

Ah... that's exactly what I'm looking for. I will download that theme and give it a try. Thank you!
dutch
 
Posts: 39
Joined: Fri Jan 27, 2012 3:25 pm

Re: two easy markdown questions

Postby dutch on Sat Jan 28, 2012 8:57 pm

Am having fun modifying the theme you pointed me to. Thanks again. One thing it doesn't do is distinguish between heading levels. The pertinent section of the theme seems to be this:

<dict>
<key>name</key>
<string>Markup: Heading</string>
<key>scope</key>
<string>markup.heading, markup.heading entity</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#000000</string>
<key>fontStyle</key>
<string></string>
<key>foreground</key>
<string>#FFFF00</string>
</dict>

Would it be terrifically complicated to build in the ability to create different color combinations for the various head levels? # through ###### ?

Also, is this the proper syntax for commenting within Markdown? :

<!--this is a test
-->

?
THANKS again for the help!
dutch
 
Posts: 39
Joined: Fri Jan 27, 2012 3:25 pm

Re: two easy markdown questions

Postby C0D312 on Sat Jan 28, 2012 9:12 pm

Just press Edit > Comment > Toggle Block Comment to comment in Markdown.

Would it be terrifically complicated to build in the ability to create different color combinations for the various head levels? # through ###### ?


I don't think the markdown.tmLanguage (the file responsible for assigning selector names to strings of text) differentiates between # and ##, etc. so I don't think that's possible, sorry.
C0D312
 
Posts: 1063
Joined: Sun Jul 10, 2011 3:23 am

Re: two easy markdown questions

Postby dutch on Sat Jan 28, 2012 9:21 pm

OK, that's fine. Thanks again for the help.
dutch
 
Posts: 39
Joined: Fri Jan 27, 2012 3:25 pm

Re: two easy markdown questions

Postby jbrooksuk on Mon Jan 30, 2012 9:05 am

C0D312 wrote:I don't think the markdown.tmLanguage (the file responsible for assigning selector names to strings of text) differentiates between # and ##, etc. so I don't think that's possible, sorry.

I'm going on a bit of a whim here but, I don't see why it wouldn't be possible. Since tmThemes are mixtures of regular expressions, you could create capture groups from 1-6 of "#" and change the colour on that.
jbrooksuk
 
Posts: 782
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: two easy markdown questions

Postby dutch on Mon Jan 30, 2012 5:39 pm

That sounds encouraging. I'm still just getting my feet wet with the more technical aspects of ST2, so I don't understand your fix entirely, but when I'm a little more knowledgeable, I'll pursue that angle. Thanks.
dutch
 
Posts: 39
Joined: Fri Jan 27, 2012 3:25 pm

Next

Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 19 guests