add markdown mode by Chris Spencer
This commit is contained in:
parent
0bc16ea45d
commit
6c3894d851
6 changed files with 480 additions and 0 deletions
11
demo/demo.js
11
demo/demo.js
|
|
@ -66,6 +66,7 @@ var PerlMode = require("ace/mode/perl").Mode;
|
|||
var ClojureMode = require("ace/mode/clojure").Mode;
|
||||
var OcamlMode = require("ace/mode/ocaml").Mode;
|
||||
var SvgMode = require("ace/mode/svg").Mode;
|
||||
var MarkdownMode = require("ace/mode/markdown").Mode;
|
||||
var TextileMode = require("ace/mode/textile").Mode;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var GroovyMode = require("ace/mode/groovy").Mode;
|
||||
|
|
@ -172,6 +173,12 @@ exports.launch = function(env) {
|
|||
docs.svg.setMode(new SvgMode());
|
||||
docs.svg.setUndoManager(new UndoManager());
|
||||
|
||||
docs.markdown = new EditSession(require("ace/requirejs/text!demo/docs/markdown.md"));
|
||||
docs.markdown.setMode(new MarkdownMode());
|
||||
docs.markdown.setUseWrapMode(true);
|
||||
docs.markdown.setWrapLimitRange(80, 80);
|
||||
docs.markdown.setUndoManager(new UndoManager());
|
||||
|
||||
docs.textile = new EditSession(require("ace/requirejs/text!demo/docs/textile.textile"));
|
||||
docs.textile.setMode(new TextileMode());
|
||||
docs.textile.setUndoManager(new UndoManager());
|
||||
|
|
@ -208,6 +215,7 @@ exports.launch = function(env) {
|
|||
var modes = {
|
||||
text: new TextMode(),
|
||||
textile: new TextileMode(),
|
||||
markdown: new MarkdownMode(),
|
||||
svg: new SvgMode(),
|
||||
xml: new XmlMode(),
|
||||
html: new HtmlMode(),
|
||||
|
|
@ -315,6 +323,9 @@ exports.launch = function(env) {
|
|||
else if (mode instanceof SvgMode) {
|
||||
modeEl.value = "svg";
|
||||
}
|
||||
else if (mode instanceof MarkdownMode) {
|
||||
modeEl.value = "markdown";
|
||||
}
|
||||
else if (mode instanceof TextileMode) {
|
||||
modeEl.value = "textile";
|
||||
}
|
||||
|
|
|
|||
186
demo/docs/markdown.md
Normal file
186
demo/docs/markdown.md
Normal file
|
|
@ -0,0 +1,186 @@
|
|||
Ace (Ajax.org Cloud9 Editor)
|
||||
============================
|
||||
|
||||
Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Syntax highlighting
|
||||
* Automatic indent and outdent
|
||||
* An optional command line
|
||||
* Handles huge documents (100,000 lines and more are no problem)
|
||||
* Fully customizable key bindings including VI and Emacs modes
|
||||
* Themes (TextMate themes can be imported)
|
||||
* Search and replace with regular expressions
|
||||
* Highlight matching parentheses
|
||||
* Toggle between soft tabs and real tabs
|
||||
* Displays hidden characters
|
||||
* Drag and drop text using the mouse
|
||||
* Line wrapping
|
||||
* Unstructured / user code folding
|
||||
* Live syntax checker (currently JavaScript/CoffeeScript)
|
||||
|
||||
Take Ace for a spin!
|
||||
--------------------
|
||||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
|
||||
|
||||
Getting the code
|
||||
----------------
|
||||
|
||||
Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
|
||||
|
||||
```bash
|
||||
git clone git://github.com/ajaxorg/ace.git
|
||||
cd ace
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
||||
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
|
||||
|
||||
The easiest version is simply:
|
||||
|
||||
```html
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
```
|
||||
|
||||
With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
|
||||
|
||||
```css
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
height: 400px;
|
||||
}
|
||||
```
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
```html
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
```javascript
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
```
|
||||
|
||||
By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
|
||||
|
||||
```html
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
Then the mode can be used like this:
|
||||
|
||||
```javascript
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js).
|
||||
|
||||
There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki).
|
||||
|
||||
If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss).
|
||||
|
||||
Running Ace
|
||||
-----------
|
||||
|
||||
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
|
||||
|
||||
```bash
|
||||
./static.py
|
||||
```
|
||||
|
||||
Or using Node.JS
|
||||
|
||||
```bash
|
||||
./static.js
|
||||
```
|
||||
|
||||
The editor can then be opened at http://localhost:8888/index.html.
|
||||
|
||||
Package Ace
|
||||
-----------
|
||||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Afterwards Ace can be built by calling
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js normal
|
||||
```
|
||||
|
||||
The packaged Ace will be put in the 'build' folder.
|
||||
|
||||
To build the bookmarklet version execute
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js bm
|
||||
```
|
||||
|
||||
Running the Unit Tests
|
||||
----------------------
|
||||
|
||||
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
|
||||
|
||||
```bash
|
||||
npm link .
|
||||
```
|
||||
|
||||
To run the tests call:
|
||||
|
||||
```bash
|
||||
node lib/ace/test/all.js
|
||||
```
|
||||
|
||||
You can also run the tests in your browser by serving:
|
||||
|
||||
http://localhost:8888/lib/ace/test/tests.html
|
||||
|
||||
This makes debugging failing tests way more easier.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
|
||||
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
|
||||
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
|
||||
|
||||
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email.
|
||||
|
||||
Email: fabian.jakobs@web.de
|
||||
|
||||
Fax: +31 (0) 206388953
|
||||
|
||||
Address: Ajax.org B.V.
|
||||
Keizersgracht 241
|
||||
1016 EA, Amsterdam
|
||||
the Netherlands
|
||||
|
|
@ -33,6 +33,7 @@
|
|||
<option value="c_cpp">C++</option>
|
||||
<option value="clojure">Clojure</option>
|
||||
<option value="ocaml">OCaml</option>
|
||||
<option value="markdown">Markdown</option>
|
||||
<option value="textile">Textile</option>
|
||||
<option value="groovy">Groovy</option>
|
||||
<option value="scala">Scala</option>
|
||||
|
|
@ -62,6 +63,7 @@
|
|||
<option value="ocaml">OCaml</option>
|
||||
<option value="csharp">C#</option>
|
||||
<option value="svg">SVG</option>
|
||||
<option value="markdown">Markdown</option>
|
||||
<option value="textile">Textile</option>
|
||||
<option value="groovy">Groovy</option>
|
||||
<option value="scala">Scala</option>
|
||||
|
|
|
|||
81
lib/ace/mode/markdown.js
Normal file
81
lib/ace/mode/markdown.js
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Mihai Sucan <mihai DOT sucan AT gmail DOT com>
|
||||
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var XmlMode = require("ace/mode/xml").Mode;
|
||||
var HtmlMode = require("ace/mode/html").Mode;
|
||||
var Tokenizer = require("ace/tokenizer").Tokenizer;
|
||||
var MarkdownHighlightRules = require("ace/mode/markdown_highlight_rules").MarkdownHighlightRules;
|
||||
var Range = require("ace/range").Range;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new MarkdownHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(highlighter.getRules());
|
||||
this.$embeds = highlighter.getEmbeds();
|
||||
this.createModeDelegates({
|
||||
"js-": JavaScriptMode,
|
||||
"xml-": XmlMode,
|
||||
"html-": HtmlMode
|
||||
});
|
||||
};
|
||||
oop.inherits(Mode, TextMode);
|
||||
|
||||
(function() {
|
||||
this.getNextLineIndent = function(state, line, tab) {
|
||||
if (state == "listblock") {
|
||||
var match = /^((?:.+)?)([-+*][ ]+)/.exec(line);
|
||||
if (match) {
|
||||
return new Array(match[1].length + 1).join(" ") + match[2];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return this.$getIndent(line);
|
||||
}
|
||||
};
|
||||
}).call(Mode.prototype);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
194
lib/ace/mode/markdown_highlight_rules.js
Normal file
194
lib/ace/mode/markdown_highlight_rules.js
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Chris Spencer <chris.ag.spencer AT googlemail DOT com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var TextHighlightRules = require("ace/mode/text_highlight_rules").TextHighlightRules;
|
||||
var JavaScriptHighlightRules = require("ace/mode/javascript_highlight_rules").JavaScriptHighlightRules;
|
||||
var XmlHighlightRules = require("ace/mode/xml_highlight_rules").XmlHighlightRules;
|
||||
var HtmlHighlightRules = require("ace/mode/html_highlight_rules").HtmlHighlightRules;
|
||||
var CssHighlightRules = require("ace/mode/css_highlight_rules").CssHighlightRules;
|
||||
|
||||
function github_embed(tag, prefix) {
|
||||
return { // Github style block
|
||||
token : "support.function",
|
||||
regex : "^```" + tag + "\\s*$",
|
||||
next : prefix + "start"
|
||||
}
|
||||
}
|
||||
|
||||
var MarkdownHighlightRules = function() {
|
||||
|
||||
// regexp must not have capturing parentheses
|
||||
// regexps are ordered -> the first match is used
|
||||
|
||||
this.$rules = {
|
||||
"start" : [ {
|
||||
token : "empty_line",
|
||||
regex : '^$'
|
||||
}, { // code span `
|
||||
token : "support.function",
|
||||
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
||||
}, { // code block
|
||||
token : "support.function",
|
||||
regex : "^[ ]{4}.+"
|
||||
}, { // h1
|
||||
token: "markup.heading.1",
|
||||
regex: "^=+(?=\\s*$)"
|
||||
}, { // h2
|
||||
token: "markup.heading.1",
|
||||
regex: "^\\-+(?=\\s*$)"
|
||||
}, { // header
|
||||
token : function(value) {
|
||||
return "markup.heading." + value.length;
|
||||
},
|
||||
regex : "^#{1,6}"
|
||||
}, github_embed("javascript", "js-"),
|
||||
github_embed("xml", "xml-"),
|
||||
github_embed("html", "html-"),
|
||||
github_embed("css", "css-"),
|
||||
{ // Github style block
|
||||
token : "support.function",
|
||||
regex : "^```[a-zA-Z]+\\s*$",
|
||||
next : "githubblock"
|
||||
}, { // block quote
|
||||
token : "string",
|
||||
regex : "^>[ ].+$",
|
||||
next : "blockquote"
|
||||
}, { // reference
|
||||
token : ["text", "constant", "text", "url", "string", "text"],
|
||||
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?\\s*)$"
|
||||
}, { // link by reference
|
||||
token : ["text", "string", "text", "constant", "text"],
|
||||
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
||||
}, { // link by url
|
||||
token : ["text", "string", "text", "markup.underline", "string", "text"],
|
||||
regex : "(\\[)"+
|
||||
"(\\[[^\\]]*\\]|[^\\[\\]]*)"+
|
||||
"(\\]\\([ \\t]*)"+
|
||||
"(<?(?:(?:[^\\(]*?\\([^\\)]*?\\)\\S*?)|(?:.*?))>?)"+
|
||||
"((?:[ \t]*\"(?:.*?)\"[ \\t]*)?)"+
|
||||
"(\\))"
|
||||
}, { // HR *
|
||||
token : "constant",
|
||||
regex : "^[ ]{0,2}(?:[ ]?\\*[ ]?){3,}\\s*$"
|
||||
}, { // HR -
|
||||
token : "constant",
|
||||
regex : "^[ ]{0,2}(?:[ ]?\\-[ ]?){3,}\\s*$"
|
||||
}, { // HR _
|
||||
token : "constant",
|
||||
regex : "^[ ]{0,2}(?:[ ]?\\_[ ]?){3,}\\s*$"
|
||||
}, { // list
|
||||
token : "markup.list",
|
||||
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
||||
next : "listblock"
|
||||
}, { // strong ** __
|
||||
token : "string",
|
||||
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||
}, { // emphasis * _
|
||||
token : "string",
|
||||
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||
}, { //
|
||||
token : ["text", "url", "text"],
|
||||
regex : "(<)("+
|
||||
"(?:https?|ftp|dict):[^'\">\\s]+"+
|
||||
"|"+
|
||||
"(?:mailto:)?[-.\\w]+\\@[-a-z0-9]+(?:\\.[-a-z0-9]+)*\\.[a-z]+"+
|
||||
")(>)"
|
||||
}, {
|
||||
token : "text",
|
||||
regex : "[^\\*_%$`\\[#<>]+"
|
||||
} ],
|
||||
|
||||
"listblock" : [ { // Lists only escape on completely blank lines.
|
||||
token : "empty_line",
|
||||
regex : "^$",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "markup.list",
|
||||
regex : ".+"
|
||||
} ],
|
||||
|
||||
"blockquote" : [ { // BLockquotes only escape on blank lines.
|
||||
token : "empty_line",
|
||||
regex : "^\\s*$",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string",
|
||||
regex : ".+"
|
||||
} ],
|
||||
|
||||
"githubblock" : [ {
|
||||
token : "support.function",
|
||||
regex : "^```",
|
||||
next : "start"
|
||||
}, {
|
||||
token : "support.function",
|
||||
regex : ".+"
|
||||
} ]
|
||||
};
|
||||
|
||||
this.embedRules(JavaScriptHighlightRules, "js-", [{
|
||||
token : "support.function",
|
||||
regex : "^```",
|
||||
next : "start"
|
||||
}]);
|
||||
|
||||
this.embedRules(HtmlHighlightRules, "html-", [{
|
||||
token : "support.function",
|
||||
regex : "^```",
|
||||
next : "start"
|
||||
}]);
|
||||
|
||||
this.embedRules(CssHighlightRules, "css-", [{
|
||||
token : "support.function",
|
||||
regex : "^```",
|
||||
next : "start"
|
||||
}]);
|
||||
|
||||
this.embedRules(XmlHighlightRules, "xml-", [{
|
||||
token : "support.function",
|
||||
regex : "^```",
|
||||
next : "start"
|
||||
}]);
|
||||
};
|
||||
oop.inherits(MarkdownHighlightRules, TextHighlightRules);
|
||||
|
||||
exports.MarkdownHighlightRules = MarkdownHighlightRules;
|
||||
});
|
||||
|
|
@ -45,6 +45,12 @@ var TextileHighlightRules = function() {
|
|||
"start" : [
|
||||
{
|
||||
token : "keyword", // start of block
|
||||
token : function(value) {
|
||||
if (value.match(/^h\d$/))
|
||||
return "markup.heading." + value.charAt(1);
|
||||
else
|
||||
return "markup.heading";
|
||||
},
|
||||
regex : "h1|h2|h3|h4|h5|h6|bq|p|bc|pre",
|
||||
next : "blocktag"
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue