Sublime Forum

Syntax highlighting and themes for markup language

#1

Hello,

I’m trying to build a syntax highlighting for markup language but found it quite tricky. I’m know the regular expressions, installed the AAAPackageDev package, successfully created a very trivial highlighting file but then completely stuck on the scopes and how to highlight/define them.

How it looks now:

{ "name": "IVY Markup", "scopeName": "text.ivy_markup", "fileTypes": "ivy" ], "patterns": { "match" : "^h\\d. .*", "name" : "keyword.ivy_markup", "comment" : "Heading" }, { "match" : "\\*\\w(.*\\w)?\\*", "name" : "markup.bold.ivy_markup", "comment" : "Effects: strong" }, { "match" : "\\_\\w ]+\\_", "name" : "markup.italic.ivy_markup", "comment" : "Effects: emphasis" }, { "begin" : "^h\\d. .*", "end" : "^h\\d. .*" } ], "uuid": "7d7e0c90-9df4-11e2-9e96-0800200c9a66" }

And it looks like it works well, but it does not apply any formatting to the text that intended to be bold or italic, e.g. “test bold italic”.

How this should be specified? Thanks!

0 Likes

#2

Syntax definitions define scopes and color schemes make them appear in fancy ways, depending on their scope selector. So, what you need is either a color scheme that defines scopes like these:

[code]

	<dict>
		<key>name</key>
		<string>Markup: Bold</string>
		<key>scope</key>
		<string>markup.bold</string>
		<key>settings</key>
		<dict>
			<key>fontStyle</key>
			<string>bold</string>
		</dict>
	</dict>
	<dict>
		<key>name</key>
		<string>Markup: Italic</string>
		<key>scope</key>
		<string>markup.italic</string>
		<key>settings</key>
		<dict>
			<key>fontStyle</key>
			<string>italic</string>
		</dict>
	</dict>[/code]

or you need to edit your current scheme to contain them.

0 Likes

#3

Ok then. Assuming that I use “Mac Classic” color scheme, is there any way to correctly extend it (not by modifying the main theme file) with rendering rules for the new scopes (defined in the syntax definition)?

0 Likes

#4

No, you have to modify it.

Copy it from the “Theme - Default” package to “User” and edit it there, it won’t be overridden like this by future updates. Then just change the color scheme setting to point to your modified version.

0 Likes