Skip to content

Instantly share code, notes, and snippets.

@c-spencer
Created May 20, 2011 22:38
Show Gist options
  • Save c-spencer/983950 to your computer and use it in GitHub Desktop.
Save c-spencer/983950 to your computer and use it in GitHub Desktop.
// in Mode
var highlighter = new MarkdownHighlightRules();
this.$tokenizer = new Tokenizer(highlighter.getRules());
this.$embeds = highlighter.getEmbeds();
this.createModeDelegates({
"js-": JavaScriptMode
});
// in Highlighter
this.embedRules(JavaScriptHighlightRules, "js-", [{
token : "constant",
regex : "^```",
next : "start"
}]);
// Whenever in a js- state, mode callbacks will be delegated to the javascript mode.
// The escape rule is also added to every js-state, to avoid being missed by a multiline state.
// (can pass an array of states to escape from optionally)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment