Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion demo/spring-2018.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

# Header1

Some text in our markdown file

```{r}
library(feather)
library(ggplot2)
Expand Down Expand Up @@ -89,6 +91,7 @@
```

```{js}
var a = "hello"
$('.title').remove()
```

Expand All @@ -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);
Expand Down Expand Up @@ -244,7 +249,7 @@
});
</script>
<span id = "highlightInfo"></span>
<span id="formula"><span>
<span id="formula"></span>

</body>
</html>
11 changes: 10 additions & 1 deletion lib/ace/mode/markdown_highlight_rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) + "\\\\]|\\\\.)*";
Expand All @@ -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"
};
}
Expand Down Expand Up @@ -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*$",
Expand Down Expand Up @@ -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);
Expand Down