Sublime Forum

Two easy markdown questions

#1

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

0 Likes

#2

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.

0 Likes

#3

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

0 Likes

#4

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”

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.

0 Likes

#5

Ah… that’s exactly what I’m looking for. I will download that theme and give it a try. Thank you!

0 Likes

#6

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? :

?
THANKS again for the help!

0 Likes

#7

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

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.

0 Likes

#8

OK, that’s fine. Thanks again for the help.

0 Likes

#9

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.

0 Likes

#10

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.

0 Likes

#11

What font is that?

0 Likes

#12

True, but those are all set in the tmLanugage file. While the tmLanguage file can be tweaked, it will just be overridden when a new version comes out. Plus, it’s much more hassle than it’s worth.

Espresso Mono. It comes with Espresso.app and has been my favorite font since.

0 Likes

#13

[quote=“C0D312”]

True, but those are all set in the tmLanugage file. While the tmLanguage file can be tweaked, it will just be overridden when a new version comes out. Plus, it’s much more hassle than it’s worth.[/quote]

You just copy the language file to a new folder named so that it comes before the original folder alphabetically; something like “Better Markdown” or whatever. It will then not get overwritten, and it will override the original, I do this with the JSON language. It is also what AAAPackageDev does; now you understand the “AAA”. You might change the name internally in the tmLanguage file so it pops up different in the syntax menu.

0 Likes

#14

Facelessuser, either way, I don’t think dutch is interested in editting regex and JSON. He just wants pretty colors in his markdown :smile:

But yeah. He could make a new language package. Thanks for the tip.

0 Likes