Sublime Forum

ReST support

#1

I would like some support for reStructuredText markup language. I tried installing TextMate bundle for .rst files (http://svn.textmate.org/trunk/Bundles/reStructuredText.tmbundle/), but encountered following problems:

Getting it running
It only worked after renaming all .plist files to .tmLanguage, and I had to delete info.plist in package root. I hope there’s nothing important in that file.

Snippets
The snippets found in bundle are very basic ones - image, link and headings. There’s no support for tables, footnotes and other elements. The existing snippets work nicely.

Syntax highlighting
I couldn’t get it working. I have no time to research the problem, but it seems that Color Schemes need to be expanded with definitions for elements such as header, table, paragraph and similar. Best I could get is to color underlining of headings in different color.

Anybody got a better package?

0 Likes

#2

as for syntax highlighting, sublime uses different syntax to describe it. so you must convert it - maybe jon has a script or something…

0 Likes

#3

the problem with most new syntaxes is the theme most of the time.
U need to add the scopes to the theme so it knows what to color…
if the scopes are working (tmLanguage doesn’t crash sublime) then all you need to do is add the info to the theme your using.
example, autohotkey syntax…

<dict> <key>name</key> <string>Keyword command</string> <key>scope</key> <string>keyword.command.ahk</string> <key>settings</key> <dict> <key>foreground</key> <string>#ddffff</string> </dict> </dict>

in your case would be something like:

<dict> <key>name</key> <string>Markup heading</string> <key>scope</key> <string>markup.heading.restructuredtext</string> <key>settings</key> <dict> <key>foreground</key> <string>#ffff00</string> </dict> </dict>
it’ll color “markup.heading.restructuredtext” in yellow… you do that to all the things you want colored.

Reason you don’t do this with common languages is because most color schemes already come with it >.<

0 Likes

#4

Yes, I already tried this modification to Color Scheme file. As I said, it only colored heading underline, not the actual heading text. Perhaps parser didn’t mark the text correctly.

0 Likes

#5

You can use the key binding Ctrl+Alt+P to see what scope name is assigned to the text under the cursor, it’s helpful for looking into these sorts of issues.

0 Likes

#6

Is there a package for ReST already, or does this still need to be done? (A ReST-Package and I’m sold on Sublime, this is like the last thing I need … :wink: )

0 Likes