diff --git a/demo/spring-2018.html b/demo/spring-2018.html index dda5cc52d62..c9fb8bda097 100644 --- a/demo/spring-2018.html +++ b/demo/spring-2018.html @@ -56,6 +56,8 @@ # Header1 +Some text in our markdown file + ```{r} library(feather) library(ggplot2) @@ -89,6 +91,7 @@ ``` ```{js} +var a = "hello" $('.title').remove() ``` @@ -113,8 +116,10 @@ function(ace, langTools, katexPreviewer, highlighter, TexCompleter, Spellchecker, SpellcheckerPopup) { var editor = ace.edit("editor"); editor.$blockScrolling = Infinity; + // editor.setTheme("ace/theme/monokai"); var session = editor.getSession(); session.setMode("ace/mode/markdown"); + //alert("Mode Set"); session.setUseWorker(true); // SpellcheckerPopup.setup(editor); @@ -244,7 +249,7 @@ }); - + diff --git a/lib/ace/mode/markdown_highlight_rules.js b/lib/ace/mode/markdown_highlight_rules.js index 03f51bee62c..9d452bd1040 100644 --- a/lib/ace/mode/markdown_highlight_rules.js +++ b/lib/ace/mode/markdown_highlight_rules.js @@ -39,6 +39,7 @@ var XmlHighlightRules = require("./xml_highlight_rules").XmlHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var CssHighlightRules = require("./css_highlight_rules").CssHighlightRules; var RHighlightRules = require("./r_highlight_rules").RHighlightRules; +var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules; var escaped = function(ch) { return "(?:[^" + lang.escapeRegExp(ch) + "\\\\]|\\\\.)*"; @@ -47,7 +48,7 @@ var escaped = function(ch) { function github_embed(tag, prefix) { return { // Github style block token : "support.function", - regex : "^\\s*```" + tag + "\\s*$", + regex : "^\\s*```{" + tag + "}\\s*$", push : prefix + "start" }; } @@ -78,6 +79,8 @@ var MarkdownHighlightRules = function() { github_embed("xml", "xmlcode-"), github_embed("html", "htmlcode-"), github_embed("css", "csscode-"), + github_embed("python", "pycode-"), + github_embed("r", "rcode-"), { // Github style block token : "support.function", regex : "^\\s*```\\s*\\S*(?:{.*?\\})?\\s*$", @@ -228,6 +231,12 @@ var MarkdownHighlightRules = function() { next : "pop" }]); + this.embedRules(PythonHighlightRules, "pycode-", [{ + token : "support.function", + regex : "^\\s*```", + next : "pop" + }]); + this.normalizeRules(); }; oop.inherits(MarkdownHighlightRules, TextHighlightRules);