Customizing GitHub Gist Embeds

When embedding a GitHub Gist using a script tag, its contents gets injected into your page’s DOM. As the injected wrapper node has a .gist class, it’s perfectly possible to customize the appearance on your own site. Will Boyd walks us through it.

Will also created a repository with several pre-built themes. Simply add one of the CSS files to your page, and you’re good to go.

@import url('https://cdn.rawgit.com/lonekorean/gist-syntax-themes/848d6580/stylesheets/monokai.css');

Customizing GitHub Gists →
Gist Syntax Themes →

Sublime Text Markdown Syntax Highlighting

Instructions for use with SublimeText3 in the comments below

sublime-markdown

One of the features I find lacking in Sublime Text is the default support for Markdown syntax highlighting. Fortunately Sublime Text can be customized and we can define a color scheme of our own.

To get the results as shown in the screenshot above, edit your theme file (~/Library/Application Support/Sublime Text 2/Packages/Color Scheme - Default/Monokai.tmTheme) and paste in the code below (which is inspired upon this gist) just before the </array>

<dict>
	<key>name</key>
	<string>Markdown: Linebreak</string>
	<key>scope</key>
	<string>text.html.markdown meta.dummy.line-break</string>
	<key>settings</key>
	<dict>
		<key>background</key>
		<string>#A57706</string>
		<key>foreground</key>
		<string>#E0EDDD</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markdown: Raw</string>
	<key>scope</key>
	<string>text.html.markdown markup.raw.inline</string>
	<key>settings</key>
	<dict>
		<key>foreground</key>
		<string>#269186</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markdown: Punctuation for Inline Block</string>
	<key>scope</key>
	<string>punctuation.definition.raw.markdown</string>
	<key>settings</key>
	<dict>
		<key>foreground</key>
		<string>#269186</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markup: Heading</string>
	<key>scope</key>
	<string>markup.heading</string>
	<key>settings</key>
	<dict>
		<key>fontStyle</key>
		<string>bold</string>
		<key>foreground</key>
		<string>#cb4b16</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>
		<key>foreground</key>
		<string>#839496</string>
	</dict>
</dict>
<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>
		<key>foreground</key>
		<string>#586e75</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markdown: Punctuation for Bold, Italic</string>
	<key>scope</key>
	<string>punctuation.definition.bold.markdown, punctuation.definition.italic.markdown</string>
	<key>settings</key>
	<dict>
		<key>foreground</key>
		<string>#586e75</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markup: Underline</string>
	<key>scope</key>
	<string>markup.underline</string>
	<key>settings</key>
	<dict>
		<key>fontStyle</key>
		<string>underline</string>
		<key>foreground</key>
		<string>#839496</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markup: Quote</string>
	<key>scope</key>
	<string>markup.quote</string>
	<key>settings</key>
	<dict>
		<key>fontStyle</key>
		<string>italic</string>
		<key>foreground</key>
		<string>#268bd2</string>
	</dict>
</dict>
<dict>
	<key>name</key>
	<string>Markup: Separator</string>
	<key>scope</key>
	<string>meta.separator</string>
	<key>settings</key>
	<dict>
		<key>background</key>
		<string>#eee8d5</string>
		<key>fontStyle</key>
		<string>bold</string>
		<key>foreground</key>
		<string>#268bd2</string>
	</dict>
</dict>

Once you’ve saved the theme you should get the same results as seen in the screenshot above (no need for a restart) when viewing markdown files

Whilst you are at it you can also install Markdown Preview which lets you preview your files in the browser (and thus convert it to HTML)