├── src ├── files │ ├── favicon.ico │ ├── cheatsheet-a5.pdf │ └── old-js │ │ ├── misc.js │ │ ├── cheatsheet.js │ │ └── movie-definition.js ├── documents │ ├── cheat-sheet │ │ └── index.html │ ├── actions │ │ ├── merge-lines │ │ │ └── index.html.md │ │ ├── split-join-tag │ │ │ └── index.html.md │ │ ├── evaluate-math │ │ │ └── index.html.md │ │ ├── inc-dec-number │ │ │ └── index.html.md │ │ ├── go-to-pair │ │ │ └── index.html.md │ │ ├── reflect-css-value │ │ │ └── index.html.md │ │ ├── remove-tag │ │ │ └── index.html.md │ │ ├── base64 │ │ │ └── index.html.md │ │ ├── go-to-edit-point │ │ │ └── index.html.md │ │ ├── expand-abbreviation │ │ │ └── index.html.md │ │ ├── toggle-comment │ │ │ └── index.html.md │ │ ├── update-image-size │ │ │ └── index.html.md │ │ ├── select-item │ │ │ └── index.html.md │ │ ├── match-pair │ │ │ └── index.html.md │ │ ├── index.html.md │ │ └── wrap-with-abbreviation │ │ │ └── index.html.md │ ├── customization │ │ ├── preferences │ │ │ └── index.html.md │ │ ├── index.html.md │ │ ├── syntax-profiles │ │ │ └── index.html.md │ │ └── snippets │ │ │ └── index.html.md │ ├── css-abbreviations │ │ ├── fuzzy-search │ │ │ └── index.html.md │ │ ├── gradients │ │ │ └── index.html.md │ │ ├── vendor-prefixes │ │ │ └── index.html.md │ │ └── index.html.md │ ├── abbreviations │ │ ├── index.html.md │ │ ├── implicit-names │ │ │ └── index.html.md │ │ ├── lorem-ipsum │ │ │ └── index.html.md │ │ └── types │ │ │ └── index.html.md │ ├── index.html.md │ └── filters │ │ └── bem │ │ └── index.html.md ├── layouts │ ├── page.html.eco │ └── default.html.eco └── partials │ └── menu.html.eco ├── .gitignore ├── css ├── assets │ ├── _highlight.css │ ├── _preferences.css │ └── _movie.css └── main.css ├── js ├── lib │ ├── preferences.js │ ├── movie.js │ ├── fake-file.js │ └── utils.js ├── main.js └── cheatsheet │ ├── cheatsheet.js │ ├── syntax-section.js │ └── css-section.js ├── plugins └── highlight.js │ ├── ini.js │ ├── dos.js │ ├── http.js │ ├── json.js │ ├── parser3.js │ ├── smalltalk.js │ ├── go.js │ ├── profile.js │ ├── tex.js │ ├── axapta.js │ ├── java.js │ ├── bash.js │ ├── erlang-repl.js │ ├── diff.js │ ├── rib.js │ ├── rsl.js │ ├── rust.js │ ├── javascript.js │ ├── cs.js │ ├── cmake.js │ ├── scala.js │ ├── vala.js │ ├── cpp.js │ ├── vhdl.js │ ├── vbscript.js │ ├── markdown.js │ ├── lua.js │ ├── r.js │ ├── python.js │ ├── lisp.js │ ├── haskell.js │ ├── actionscript.js │ ├── matlab.js │ ├── nginx.js │ ├── avrasm.js │ ├── delphi.js │ ├── xml.js │ ├── django.js │ ├── css.js │ ├── sql.js │ ├── coffeescript.js │ ├── objectivec.js │ ├── php.js │ ├── 1c.js │ ├── erlang.js │ ├── clojure.js │ └── ruby.js ├── package.json ├── .travis.yml ├── README.md ├── docpad.coffee └── gulpfile.js /src/files/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmetio/emmet-docs/HEAD/src/files/favicon.ico -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules 3 | /out 4 | 5 | .build-catalog.json 6 | 7 | /deploy.sh 8 | .DS_Store -------------------------------------------------------------------------------- /src/files/cheatsheet-a5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/emmetio/emmet-docs/HEAD/src/files/cheatsheet-a5.pdf -------------------------------------------------------------------------------- /css/assets/_highlight.css: -------------------------------------------------------------------------------- 1 | .xml .tag, 2 | .css .tag, 3 | .json .attribute { 4 | color: #2F6F9F; 5 | } 6 | 7 | .xml .tag .attribute { 8 | color: #4F9FCF; 9 | } 10 | 11 | .xml .tag .value, 12 | .json .value, 13 | .javascript .string, 14 | .r .string { 15 | color: #d44950; 16 | } 17 | 18 | .xml .comment, 19 | .javascript .comment { 20 | color: #999; 21 | } -------------------------------------------------------------------------------- /src/documents/cheat-sheet/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Cheat Sheet 4 | menuOrder: 6 5 | css1: "/css/cheatsheet.css" 6 | js1: "/js/cheatsheet.js" 7 | --- 8 |

Download cheat sheet as printable PDF A5

9 |
10 | -------------------------------------------------------------------------------- /src/layouts/page.html.eco: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 |

<%= @document.documentTitle or @document.title %>

5 | <%- @content %> 6 |
7 | 8 | comments powered by Disqus -------------------------------------------------------------------------------- /src/partials/menu.html.eco: -------------------------------------------------------------------------------- 1 | <% renderMenu = (items) => %> 2 | 16 | <% end %> 17 | <%= renderMenu @menuItems %> -------------------------------------------------------------------------------- /src/documents/actions/merge-lines/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Merge Lines 4 | menuOrder: 9 5 | --- 6 | Many editors have similar action: it merges selected lines into a single one. But when there’s no selection, Emmet will match context HTML tag. 7 | 8 | 18 | -------------------------------------------------------------------------------- /src/documents/actions/split-join-tag/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Split/Join Tag 4 | menuOrder: 7 5 | --- 6 | This action splits and joins tag definition, e.g. converts from `` to `` and vice versa. Very useful for XML/XSL developers. 7 | 18 | 19 | ---------------- 20 | 21 | “Split/Join Tag” action uses “[HTML Matcher](/actions/match-pair/)” internally so it may work in non-HTML syntaxes too. 22 | -------------------------------------------------------------------------------- /src/documents/customization/preferences/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: "preferences.json" 4 | menuOrder: 2 5 | --- 6 | The `preferences.json` file is used to modify behavior of some actions and resolvers of Emmet. This file contains a simple dictionary of key–value pairs. 7 | 8 | For example, on “[CSS Gradients](/css-abbreviations/gradients/)” there’s description of `css.gradient.fallback` option which enables fallback `background-color` value when definition is expanded. To enable it, simply add this key to `preferences.json` file: 9 | 10 | { 11 | "css.gradient.fallback": true 12 | } 13 | 14 | Here’s a list of currently available options: 15 | 16 |
17 | -------------------------------------------------------------------------------- /js/lib/preferences.js: -------------------------------------------------------------------------------- 1 | import {template, delegate} from './utils'; 2 | import {emmet} from './movie'; 3 | 4 | function generatePreferencesTable() { 5 | var prefs = emmet.preferences.list(); 6 | var row = template(` 7 | 8 | <%= name %> 9 |
<%= description %>
10 | 11 | 12 | <%- value %> 13 | 14 | `); 15 | 16 | return `${prefs.map(item => row(item)).join('')}
`; 17 | } 18 | 19 | export default function(elem) { 20 | elem.innerHTML = generatePreferencesTable(); 21 | delegate(elem, '.emmet-preferences__value', evt => elem.classList.toggle('emmet-preferences__value_full')) 22 | } -------------------------------------------------------------------------------- /css/assets/_preferences.css: -------------------------------------------------------------------------------- 1 | .emmet-preferences table { 2 | margin: 0; 3 | } 4 | 5 | .emmet-preferences td { 6 | vertical-align: top; 7 | } 8 | 9 | .emmet-preferences__name { 10 | font-weight: bold; 11 | } 12 | 13 | .emmet-preferences__desc { 14 | font-size: 0.85em; 15 | } 16 | 17 | .emmet-preferences__value { 18 | white-space: pre; 19 | text-overflow: ellipsis; 20 | overflow: hidden; 21 | display: inline-block; 22 | max-width: 16em; 23 | font-size: 0.85em; 24 | cursor: default; 25 | padding: 0 5px; 26 | border: 1px solid #eaeaea; 27 | background: #f8f8f8; 28 | font-family: Monaco, Bitstream Vera Sans Mono, "Lucida Console", Terminal; 29 | -webkit-border-radius: 5px; 30 | -moz-border-radius: 5px; 31 | border-radius: 5px; 32 | } 33 | 34 | .emmet-preferences__value_full { 35 | white-space: normal; 36 | } -------------------------------------------------------------------------------- /src/documents/actions/evaluate-math/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Evaluate Math Expression 4 | menuOrder: 11 5 | --- 6 | Evaluates simple math expression like `2*4` or `10/2` and outputs its result. You can use `\` operator which is equivalent to `round(a/b)`. 7 | 8 | Very useful in CSS where numeric values should be modified frequently. 9 | 10 | -------------------------------------------------------------------------------- /plugins/highlight.js/ini.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | illegal: '[^\\s]', 6 | contains: [ 7 | { 8 | className: 'comment', 9 | begin: ';', end: '$' 10 | }, 11 | { 12 | className: 'title', 13 | begin: '^\\[', end: '\\]' 14 | }, 15 | { 16 | className: 'setting', 17 | begin: '^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*', end: '$', 18 | contains: [ 19 | { 20 | className: 'value', 21 | endsWithParent: true, 22 | keywords: 'on off true false yes no', 23 | contains: [hljs.QUOTE_STRING_MODE, hljs.NUMBER_MODE] 24 | } 25 | ] 26 | } 27 | ] 28 | } 29 | }; 30 | }; -------------------------------------------------------------------------------- /src/documents/actions/inc-dec-number/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Increment/Decrement Number 4 | menuOrder: 12 5 | --- 6 | This action, as name says, increments or decrements number under caret with different steps: 0.1, 1 or 10. 7 | -------------------------------------------------------------------------------- /src/documents/actions/go-to-pair/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Go to Matching Pair 4 | menuOrder: 2.5 5 | --- 6 | In HTML, allows you to quickly traverse between opening and closing tag: 7 | 8 | 20 | 21 | ---------------- 22 | 23 | “Go to Matching Pair” action uses “[HTML Matcher](/actions/match-pair/)” internally so it may work in non-HTML syntaxes too. 24 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emmetio-docs", 3 | "description": "Emmet Docs & Tutorials", 4 | "version": "1.1.0", 5 | "private": true, 6 | "scripts": { 7 | "start": "docpad run" 8 | }, 9 | "devDependencies": { 10 | "docpad": "^6.73.5", 11 | "docpad-plugin-eco": "^2.1.0", 12 | "docpad-plugin-frontend": "^2.0.1", 13 | "docpad-plugin-marked": "^2.3.0", 14 | "docpad-plugin-menu": "^2.1.0", 15 | "docpad-plugin-partials": "^2.9.2", 16 | "gulp": "^3.8.11", 17 | "gulp-gzip": "^1.0.0", 18 | "gulp-minify-css": "^1.0.0", 19 | "html-transform": "git+https://github.com/sergeche/html-transform.git#v1.1.0", 20 | "js-bundler": "git+https://github.com/sergeche/js-bundler.git#v1.0.0", 21 | "safeps": "^2.2.13" 22 | }, 23 | "dependencies": { 24 | "codemirror": "^5.0.0", 25 | "codemirror-movie": "^1.2.1", 26 | "emmet-codemirror": "^1.2.4", 27 | "through2": "^2.0.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/documents/actions/reflect-css-value/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Reflect CSS Value 4 | menuOrder: 13 5 | --- 6 | A very useful action for CSS developers: it takes value of CSS property under caret and copies it into vendor-prefixed variations with additional transformations, if required. 7 | -------------------------------------------------------------------------------- /src/documents/actions/remove-tag/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Remove Tag 4 | menuOrder: 8 5 | --- 6 | Quickly removes tag, found by “[Balance](/actions/match-pair/)” action from current caret position, and adjusts indentation. 7 | 8 | 23 | 24 | ---------------- 25 | 26 | “Remove Tag” action uses “[HTML Matcher](/actions/match-pair/)” internally so it may work in non-HTML syntaxes too. 27 | 28 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - '0.10' 4 | env: 5 | global: 6 | - secure: sNJQXWkB//P8JhsdLQKhFbKeCcJ2sb6FiEDpqK5UwFGMt9NRnqFCxDHVxpmr61uPB2XmJr5WdhpeOH6TXttEM31QRuBWg02XbXLEhCgQESh/wg5Ro76OSRZ71iAYXLwFxlkdJ3qgVm0hnLjLTKmYuKu7C1E5bH9/wma1S8Y4PLM= 7 | - secure: kez8ylnc99MwHpXNBvUZ3iweAbiXO04NBxB/mRxpl/KF3ZBPwokmd23yoGztm5SRuBTKdpQAXSEryDF2VbE4Pqz94kxxJKqizahGRJJt9JOThZZHhdNoUt44wLz6YLh5RmiYQe/3JFwBxbdyBeEE5Vud2I8Yy7o+dR+c7aztSSk= 8 | - secure: tcFLn8fgP/gxtZQC2iO70tABBOrqB/CFvAfWj9sr069mc6STaVahVol7Wo77cDr4WkrtvpMVXe/laeqsKyMe7vUVbGSuby8tJOrOK5LNuTfgmvS3OFmXCRYsyCa806ft/CLv4nw9Ld8IQGRMXUQCK1wAm6xhRLQF5MMTDQkiqiQ= 9 | addons: 10 | ssh_known_hosts: 11 | - 128.199.54.7 12 | script: ./node_modules/.bin/docpad generate --silent --env production 13 | branches: 14 | only: 15 | - master 16 | after_success: 17 | - sudo apt-get -y -qq install sshpass 18 | - rsync -arlptzO --delete --stats --rsh="sshpass -p $DEPLOY_PASSWORD ssh -l $DEPLOY_USER" ./out/ 128.199.54.7:$DEPLOY_DEST 19 | -------------------------------------------------------------------------------- /plugins/highlight.js/dos.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | keywords: { 6 | flow: 'if else goto for in do call exit not exist errorlevel defined equ neq lss leq gtr geq', 7 | keyword: 'shift cd dir echo setlocal endlocal set pause copy', 8 | stream: 'prn nul lpt3 lpt2 lpt1 con com4 com3 com2 com1 aux', 9 | winutils: 'ping net ipconfig taskkill xcopy ren del' 10 | }, 11 | contains: [ 12 | { 13 | className: 'envvar', begin: '%%[^ ]' 14 | }, 15 | { 16 | className: 'envvar', begin: '%[^ ]+?%' 17 | }, 18 | { 19 | className: 'envvar', begin: '![^ ]+?!' 20 | }, 21 | { 22 | className: 'number', begin: '\\b\\d+', 23 | relevance: 0 24 | }, 25 | { 26 | className: 'comment', 27 | begin: '@?rem', end: '$' 28 | } 29 | ] 30 | } 31 | }; 32 | }; -------------------------------------------------------------------------------- /src/documents/actions/base64/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: "Encode/Decode Image to data:URL" 4 | menuOrder: 14 5 | --- 6 | HTML and CSS allows you to embed external resources right into base using [data:URL](http://en.wikipedia.org/wiki/Data_URI_scheme) scheme. Usually, image conversion to base64 is done with external on-line services or third-party assets builder. 7 | 8 | But these tools have downsides: you have to spend extra time on on-line tools or lose control on images that should or should not be converted to base64. 9 | 10 | With Emmet, you can convert image to data:URL right in your editor, as well as convert it _back to external file_. 11 | 12 | 26 | -------------------------------------------------------------------------------- /src/documents/actions/go-to-edit-point/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Go to Edit Point 4 | menuOrder: 4 5 | --- 6 | This action works for HTML code blocks and allows you to quickly traverse between important code points: 7 | 8 | * between tags 9 | * empty attributes 10 | * newlines with indentation 11 | 12 | 34 | -------------------------------------------------------------------------------- /plugins/highlight.js/http.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | illegal: '\\S', 5 | contains: [ 6 | { 7 | className: 'status', 8 | begin: '^HTTP/[0-9\\.]+', end: '$', 9 | contains: [{className: 'number', begin: '\\b\\d{3}\\b'}] 10 | }, 11 | { 12 | className: 'request', 13 | begin: '^[A-Z]+ (.*?) HTTP/[0-9\\.]+$', returnBegin: true, end: '$', 14 | contains: [ 15 | { 16 | className: 'string', 17 | begin: ' ', end: ' ', 18 | excludeBegin: true, excludeEnd: true 19 | } 20 | ] 21 | }, 22 | { 23 | className: 'attribute', 24 | begin: '^\\w', end: ': ', excludeEnd: true, 25 | illegal: '\\n', 26 | starts: {className: 'string', end: '$'} 27 | }, 28 | { 29 | begin: '\\n\\n', 30 | starts: {subLanguage: '', endsWithParent: true} 31 | } 32 | ] 33 | } 34 | }; 35 | }; -------------------------------------------------------------------------------- /src/documents/actions/expand-abbreviation/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Expand Abbreviation 4 | menuOrder: 1 5 | --- 6 | Expands [CSS-like abbreviations](/abbreviations/) into HTML/XML/CSS code, depending on current document’s syntax. Also performs other context actions, for example, transforms [CSS Gradient](/css-abbreviations/gradients/). 7 | 8 | 24 | 25 | Generated output contains a number of _tabstops_ and if your editor supports them (Eclipse, Sublime Text 2, Espresso etc) you can quickly traverse between them with Tab key. 26 | 27 | In some editors (Eclipse, Sublime Text 2, CodeMirror) “Expand Abbreviation” can be invoked with Tab key. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Official documentation site for Emmet toolkit 2 | 3 | Currently, the main web-site skeleton is finished (maybe a few bugs out there), and I’m currently writing documentation for Emmet toolkit. Documentation itself is located in `src/documents` folder. 4 | 5 | The web-site uses [DocPad](https://github.com/bevry/docpad) for static site generation. 6 | 7 | ## Local setup 8 | 9 | To run this web-site locally, you need the following dependencies: 10 | 11 | 1. Node.JS >= v0.6 12 | 2. NPM 13 | 3. DocPad installed globally: `npm install -g docpad` 14 | 15 | ### Running local web-site instance 16 | 17 | 1. Clone this repo (note that this project uses submodules, please use --recursive option) and go to the cloned folder 18 | 2. Run `npm install` to install all project local dependencies 19 | 3. Run `docpad run`. This command will build all JS & CSS assets, generate static HTML-page and set-up local web-server (usually http://localhost:9778/) where generated web-site can be viewed. 20 | 21 | Note that you should view the web-site _only_ with local web-server since generated pages contains absolute, cache-busted references to CSS and JS files. 22 | -------------------------------------------------------------------------------- /src/documents/customization/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Customization 4 | menuOrder: 5 5 | --- 6 | Emmet offers wide range of tweaks you can use to fine-tune your plugin experience. Almost all officially developed editor plugins (except PSPad and browser-based) has **extensions support**: a special folder where you can put `json` and `js` files to extend Emmet. Please refer to README file bundled with your editor’s plugin to find out where Emmet looks for extensions. 7 | 8 | Each `.js` file located in extensions folder will be loaded and executed on plugin start-up. Use `js` files to create your own [filters](/filters/) or [actions](/actions/): you can use Emmet modules and bindings to script your editor with JavaScript. 9 | 10 | With `.json` files you can fine-tune different parts of Emmet toolkit: 11 | 12 |
13 |
[snippets.json](./snippets/)
14 |
Add your own or update existing snippets
15 |
[preferences.json](./preferences/)
16 |
Change behavior of some Emmet filters and actions
17 |
[syntaxProfiles.json](./syntax-profiles/)
18 |
Define how generated HTML/XML should look.
19 |
-------------------------------------------------------------------------------- /css/assets/_movie.css: -------------------------------------------------------------------------------- 1 | /* Simpe UI for CodeMirror Movie */ 2 | @import url(../bootstrap/css/bootstrap.css); 3 | 4 | /* Splash screen */ 5 | .CodeMirror-movie__splash { 6 | position: absolute; 7 | width: 100%; 8 | height: 100%; 9 | top: 0; 10 | left: 0; 11 | color: #000; 12 | background: #dfdfdf; 13 | background: rgba(215, 215, 215, 0.9); 14 | z-index: 10; 15 | cursor: pointer; 16 | } 17 | 18 | .CodeMirror-movie__splash:hover { 19 | color: #0088cc; 20 | } 21 | 22 | .CodeMirror-movie__splash-text { 23 | font-size: 4em; 24 | font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; 25 | position: absolute; 26 | width: 100%; 27 | text-align: center; 28 | top: 50%; 29 | margin-top: -1.2em; 30 | line-height: 1em; 31 | } 32 | 33 | .CodeMirror-movie__splash-play-btn { 34 | display: inline-block; 35 | font-size: 1.5em; 36 | line-height: 1em; 37 | width: 1em; 38 | height: 1em; 39 | padding: 0.33em 0.2em 0.27em 0.4em; 40 | background: #fff; 41 | border-radius: 100%; 42 | vertical-align: middle; 43 | } 44 | 45 | /* Toolbar */ 46 | .CodeMirror-movie__toolbar { 47 | margin-bottom: 10px; 48 | } 49 | 50 | .CodeMirror-movie__btn-try { 51 | float: right; 52 | } -------------------------------------------------------------------------------- /src/documents/actions/toggle-comment/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Toggle Comment 4 | menuOrder: 6 5 | --- 6 | This action, as name says, toggle comment on selection. Almost all programmer’s text editors have such action, but this one works differently. When there’s no selection, editor’s action toggles comment on current line while Emmet’s one do this on _current context_. For HTML it’s a full tag, for CSS it’s a rule or full property. 7 | 8 | 28 | -------------------------------------------------------------------------------- /src/documents/css-abbreviations/fuzzy-search/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Fuzzy search 4 | menuOrder: 3 5 | --- 6 | If you take a look at [Cheat Sheet](/cheat-sheet/), you’ll find that there are too many CSS snippets to remember. Also, some of them might be a bit lengthy for sake of logical separation. 7 | 8 | To make CSS writing a bit easier, Emmet implement _fuzzy search_ logic for CSS snippets: every time you enter unknown abbreviation, Emmet will try to find a closest snippet definition. 9 | 10 | For example, instead of writing `ov:h` (`overflow: hidden;`) abbreviation, you can write `ov-h`, `ovh` or even `oh`. You can play around with the fuzzy search in text editor below. Try to find as many variations as possible (use Tab key to expand abbreviations) for `bxz:cb`, `ovx:h` and `pos:a` snippets. 11 | 12 | 13 | 14 | The fuzzy search is performed against _predefined snippet names_, not snippet values or CSS properties. This results in more predictable and controllable matches. Remember that you can always [create your own snippets or redefine existing ones](/customization/) to fine-tune fuzzy search experience. -------------------------------------------------------------------------------- /plugins/highlight.js/json.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var LITERALS = {literal: 'true false null'}; 3 | var TYPES = [ 4 | hljs.QUOTE_STRING_MODE, 5 | hljs.C_NUMBER_MODE 6 | ]; 7 | var VALUE_CONTAINER = { 8 | className: 'value', 9 | end: ',', endsWithParent: true, excludeEnd: true, 10 | contains: TYPES, 11 | keywords: LITERALS 12 | }; 13 | var OBJECT = { 14 | begin: '{', end: '}', 15 | contains: [ 16 | { 17 | className: 'attribute', 18 | begin: '\\s*"', end: '"\\s*:\\s*', excludeBegin: true, excludeEnd: true, 19 | contains: [hljs.BACKSLASH_ESCAPE], 20 | illegal: '\\n', 21 | starts: VALUE_CONTAINER 22 | } 23 | ], 24 | illegal: '\\S' 25 | }; 26 | var ARRAY = { 27 | begin: '\\[', end: '\\]', 28 | contains: [hljs.inherit(VALUE_CONTAINER, {className: null})], // inherit is also a workaround for a bug that makes shared modes with endsWithParent compile only the ending of one of the parents 29 | illegal: '\\S' 30 | }; 31 | TYPES.splice(TYPES.length, 0, OBJECT, ARRAY); 32 | return { 33 | defaultMode: { 34 | contains: TYPES, 35 | keywords: LITERALS, 36 | illegal: '\\S' 37 | } 38 | }; 39 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/parser3.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | subLanguage: 'xml', 5 | contains: [ 6 | { 7 | className: 'comment', 8 | begin: '^#', end: '$' 9 | }, 10 | { 11 | className: 'comment', 12 | begin: '\\^rem{', end: '}', 13 | relevance: 10, 14 | contains: [ 15 | { 16 | begin: '{', end: '}', 17 | contains: ['self'] 18 | } 19 | ] 20 | }, 21 | { 22 | className: 'preprocessor', 23 | begin: '^@(?:BASE|USE|CLASS|OPTIONS)$', 24 | relevance: 10 25 | }, 26 | { 27 | className: 'title', 28 | begin: '@[\\w\\-]+\\[[\\w^;\\-]*\\](?:\\[[\\w^;\\-]*\\])?(?:.*)$' 29 | }, 30 | { 31 | className: 'variable', 32 | begin: '\\$\\{?[\\w\\-\\.\\:]+\\}?' 33 | }, 34 | { 35 | className: 'keyword', 36 | begin: '\\^[\\w\\-\\.\\:]+' 37 | }, 38 | { 39 | className: 'number', 40 | begin: '\\^#[0-9a-fA-F]+' 41 | }, 42 | hljs.C_NUMBER_MODE 43 | ] 44 | } 45 | }; 46 | }; -------------------------------------------------------------------------------- /src/documents/actions/update-image-size/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Update Image Size 4 | menuOrder: 10 5 | --- 6 | Many web-developers forget to write _width_ and _height_ attributes for `` tags which leads to poor UX. This action helps you to automate this process: simply place caret inside `` tag and run this action to add/update width and height attributes. 7 | 8 | In CSS, place caret inside property value with `url()` function to add/update width and height properties for current rule. 9 | 10 | 28 | 29 | Note that this action also works for absolute URLs: it will start searching for requested file from host file’s folder and then will traverse up the tree. -------------------------------------------------------------------------------- /js/lib/movie.js: -------------------------------------------------------------------------------- 1 | import EmmetCodemirror from 'emmet-codemirror'; 2 | import CodeMirrorMovie from 'codemirror-movie'; 3 | import CodeMirror from 'codemirror'; 4 | 5 | import 'codemirror/mode/css/css.js'; 6 | import 'codemirror/mode/xml/xml.js'; 7 | import 'codemirror/mode/javascript/javascript.js'; 8 | import 'codemirror/mode/htmlmixed/htmlmixed.js'; 9 | import 'codemirror/addon/selection/active-line.js'; 10 | 11 | var emmet = EmmetCodemirror.emmet; 12 | var EmmetEditor = EmmetCodemirror.EmmetEditor; 13 | 14 | EmmetCodemirror.setup(CodeMirror); 15 | window.CodeMirror = CodeMirror; 16 | window.emmet = emmet; 17 | // add 'revert' action to CodeMirror to restore original text and position 18 | CodeMirror.commands.revert = function(editor) { 19 | if (editor.__initial) { 20 | editor.setValue(editor.__initial.content); 21 | editor.setCursor(editor.__initial.pos); 22 | } 23 | }; 24 | 25 | CodeMirror.commands.wrapWithAbbreviation = function(editor, abbr) { 26 | emmet.run('wrap_with_abbreviation', new EmmetEditor(editor), abbr); 27 | }; 28 | 29 | EmmetCodemirror.defaultKeymap['Shift-Cmd-U'] = 'emmet.update_image_size'; 30 | EmmetCodemirror.defaultKeymap['Shift-Cmd-I'] = 'emmet.encode_decode_data_url'; 31 | 32 | export {CodeMirror, CodeMirrorMovie, EmmetCodemirror, emmet}; -------------------------------------------------------------------------------- /src/documents/abbreviations/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Abbreviations 4 | menuOrder: 1 5 | --- 6 | Abbreviations are the heart of the Emmet toolkit: these special expressions are parsed in runtime and transformed into structured code block, HTML for example. The abbreviation’s syntax looks like CSS selectors with a few extensions specific to code generation. So every web-developer already knows how to use it. 7 | 8 | Here’s an example: this abbreviation 9 | 10 | #page>div.logo+ul#navigation>li*5>a{Item $} 11 | 12 | ...can be transformed into 13 | 14 |
15 | 16 | 23 |
24 | 25 | ...with just a single key stroke. In many editors (such as Eclipse, Sublime Text 2, Espresso etc.) plugins will also generate proper _tabstop marks_ so you can quickly traverse between important places of generated code with the Tab key. 26 | 27 | Abbreviations are optimised for, but not limited to, HTML and XML generation, and make writing tedious markup code a breeze. You can start learning [syntax](/abbreviations/syntax/) to unleash the full power of Emmet abbreviations. -------------------------------------------------------------------------------- /plugins/highlight.js/smalltalk.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var VAR_IDENT_RE = '[a-z][a-zA-Z0-9_]*'; 3 | var CHAR = { 4 | className: 'char', 5 | begin: '\\$.{1}' 6 | }; 7 | var SYMBOL = { 8 | className: 'symbol', 9 | begin: '#' + hljs.UNDERSCORE_IDENT_RE 10 | }; 11 | return { 12 | defaultMode: { 13 | keywords: 'self super nil true false thisContext', // only 6 14 | contains: [ 15 | { 16 | className: 'comment', 17 | begin: '"', end: '"', 18 | relevance: 0 19 | }, 20 | hljs.APOS_STRING_MODE, 21 | { 22 | className: 'class', 23 | begin: '\\b[A-Z][A-Za-z0-9_]*', 24 | relevance: 0 25 | }, 26 | { 27 | className: 'method', 28 | begin: VAR_IDENT_RE + ':' 29 | }, 30 | hljs.C_NUMBER_MODE, 31 | SYMBOL, 32 | CHAR, 33 | { 34 | className: 'localvars', 35 | begin: '\\|\\s*((' + VAR_IDENT_RE + ')\\s*)+\\|' 36 | }, 37 | { 38 | className: 'array', 39 | begin: '\\#\\(', end: '\\)', 40 | contains: [ 41 | hljs.APOS_STRING_MODE, 42 | CHAR, 43 | hljs.C_NUMBER_MODE, 44 | SYMBOL 45 | ] 46 | } 47 | ] 48 | } 49 | }; 50 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/go.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var GO_KEYWORDS = { 3 | keyword: 4 | 'break default func interface select case map struct chan else goto package switch ' + 5 | 'const fallthrough if range type continue for import return var go defer', 6 | constant: 7 | 'true false iota nil', 8 | typename: 9 | 'bool byte complex64 complex128 float32 float64 int8 int16 int32 int64 string uint8 ' + 10 | 'uint16 uint32 uint64 int uint uintptr rune', 11 | built_in: 12 | 'append cap close complex copy imag len make new panic print println real recover delete' 13 | }; 14 | return { 15 | defaultMode: { 16 | keywords: GO_KEYWORDS, 17 | illegal: ' { 38 | return {width: 200, height: 150} 39 | }; -------------------------------------------------------------------------------- /src/documents/actions/select-item/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Select Item 4 | menuOrder: 5 5 | --- 6 | Action is similar to [“Go to Edit Point”](/actions/go-to-edit-point/), but selects important code parts. 7 | 8 | In HTML, these are tag name, full attribute and attribute value. For class attribute it also selects distinct classes. 9 | 10 | 28 | 29 | In CSS, it matches selector, full property and property value. For complex values and functions like `1px solid red` or `url(image.jpg)` also selects part of it. 30 | 31 | -------------------------------------------------------------------------------- /plugins/highlight.js/java.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | keywords: 5 | 'false synchronized int abstract float private char boolean static null if const ' + 6 | 'for true while long throw strictfp finally protected import native final return void ' + 7 | 'enum else break transient new catch instanceof byte super volatile case assert short ' + 8 | 'package default double public try this switch continue throws', 9 | contains: [ 10 | { 11 | className: 'javadoc', 12 | begin: '/\\*\\*', end: '\\*/', 13 | contains: [{ 14 | className: 'javadoctag', begin: '@[A-Za-z]+' 15 | }], 16 | relevance: 10 17 | }, 18 | hljs.C_LINE_COMMENT_MODE, 19 | hljs.C_BLOCK_COMMENT_MODE, 20 | hljs.APOS_STRING_MODE, 21 | hljs.QUOTE_STRING_MODE, 22 | { 23 | className: 'class', 24 | beginWithKeyword: true, end: '{', 25 | keywords: 'class interface', 26 | illegal: ':', 27 | contains: [ 28 | { 29 | beginWithKeyword: true, 30 | keywords: 'extends implements', 31 | relevance: 10 32 | }, 33 | { 34 | className: 'title', 35 | begin: hljs.UNDERSCORE_IDENT_RE 36 | } 37 | ] 38 | }, 39 | hljs.C_NUMBER_MODE, 40 | { 41 | className: 'annotation', begin: '@[A-Za-z]+' 42 | } 43 | ] 44 | } 45 | }; 46 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/bash.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var BASH_LITERAL = 'true false'; 3 | var VAR1 = { 4 | className: 'variable', begin: '\\$[a-zA-Z0-9_]+\\b' 5 | }; 6 | var VAR2 = { 7 | className: 'variable', begin: '\\${([^}]|\\\\})+}' 8 | }; 9 | var QUOTE_STRING = { 10 | className: 'string', 11 | begin: '"', end: '"', 12 | illegal: '\\n', 13 | contains: [hljs.BACKSLASH_ESCAPE, VAR1, VAR2], 14 | relevance: 0 15 | }; 16 | var APOS_STRING = { 17 | className: 'string', 18 | begin: '\'', end: '\'', 19 | contains: [{begin: '\'\''}], 20 | relevance: 0 21 | }; 22 | var TEST_CONDITION = { 23 | className: 'test_condition', 24 | begin: '', end: '', 25 | contains: [QUOTE_STRING, APOS_STRING, VAR1, VAR2], 26 | keywords: { 27 | literal: BASH_LITERAL 28 | }, 29 | relevance: 0 30 | }; 31 | 32 | return { 33 | defaultMode: { 34 | keywords: { 35 | keyword: 'if then else fi for break continue while in do done echo exit return set declare', 36 | literal: BASH_LITERAL 37 | }, 38 | contains: [ 39 | { 40 | className: 'shebang', 41 | begin: '(#!\\/bin\\/bash)|(#!\\/bin\\/sh)', 42 | relevance: 10 43 | }, 44 | VAR1, 45 | VAR2, 46 | hljs.HASH_COMMENT_MODE, 47 | QUOTE_STRING, 48 | APOS_STRING, 49 | hljs.inherit(TEST_CONDITION, {begin: '\\[ ', end: ' \\]', relevance: 0}), 50 | hljs.inherit(TEST_CONDITION, {begin: '\\[\\[ ', end: ' \\]\\]'}) 51 | ] 52 | } 53 | }; 54 | }; -------------------------------------------------------------------------------- /src/files/old-js/misc.js: -------------------------------------------------------------------------------- 1 | ;$(function() { 2 | function generatePreferencesTable() { 3 | var prefs = emmet.require('preferences').list(); 4 | var row = _.template('' 5 | + '' 6 | + '<%= name %>' 7 | + '
<%= description %>
' 8 | + '' 9 | + '<%- value %>' 10 | + ''); 11 | var output = '' ; 12 | _.each(prefs, function(item) { 13 | output += row(item); 14 | }); 15 | 16 | return output + '
'; 17 | } 18 | 19 | $('.emmet-preferences').each(function() { 20 | $(this) 21 | .html(generatePreferencesTable()) 22 | .on('click', '.emmet-preferences__value', function() { 23 | $(this).toggleClass('emmet-preferences__value_full'); 24 | }); 25 | }); 26 | 27 | // create editor boxes in page 28 | $('.cm-box').each(function() { 29 | var options = { 30 | theme: 'espresso', 31 | mode : $(this).data('cm-mode') || 'text/html', 32 | indentWithTabs: true, 33 | tabSize: 4, 34 | lineNumbers : true, 35 | onCursorActivity: function() { 36 | editor.setLineClass(hlLine, null, null); 37 | hlLine = editor.setLineClass(editor.getCursor().line, null, "activeline"); 38 | } 39 | } 40 | var editor = CodeMirror.fromTextArea(this, options); 41 | var hlLine = editor.setLineClass(0, 'activeline'); 42 | 43 | if ($(this).data('height')) { 44 | editor.getWrapperElement().style.height = $(this).data('height') + 'px'; 45 | } 46 | }); 47 | }); -------------------------------------------------------------------------------- /plugins/highlight.js/erlang-repl.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | keywords: { 5 | special_functions: 6 | 'spawn spawn_link self', 7 | reserved: 8 | 'after and andalso|10 band begin bnot bor bsl bsr bxor case catch cond div end fun if ' + 9 | 'let not of or orelse|10 query receive rem try when xor' 10 | }, 11 | contains: [ 12 | { 13 | className: 'input_number', begin: '^[0-9]+> ', 14 | relevance: 10 15 | }, 16 | { 17 | className: 'comment', 18 | begin: '%', end: '$' 19 | }, 20 | { 21 | className: 'number', 22 | begin: '\\b(\\d+#[a-fA-F0-9]+|\\d+(\\.\\d+)?([eE][-+]?\\d+)?)', 23 | relevance: 0 24 | }, 25 | hljs.APOS_STRING_MODE, 26 | hljs.QUOTE_STRING_MODE, 27 | { 28 | className: 'constant', begin: '\\?(::)?([A-Z]\\w*(::)?)+' 29 | }, 30 | { 31 | className: 'arrow', begin: '->' 32 | }, 33 | { 34 | className: 'ok', begin: 'ok' 35 | }, 36 | { 37 | className: 'exclamation_mark', begin: '!' 38 | }, 39 | { 40 | className: 'function_or_atom', 41 | begin: '(\\b[a-z\'][a-zA-Z0-9_\']*:[a-z\'][a-zA-Z0-9_\']*)|(\\b[a-z\'][a-zA-Z0-9_\']*)', 42 | relevance: 0 43 | }, 44 | { 45 | className: 'variable', 46 | begin: '[A-Z][a-zA-Z0-9_\']*', 47 | relevance: 0 48 | } 49 | ] 50 | } 51 | }; 52 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/diff.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | contains: [ 6 | { 7 | className: 'chunk', 8 | begin: '^\\@\\@ +\\-\\d+,\\d+ +\\+\\d+,\\d+ +\\@\\@$', 9 | relevance: 10 10 | }, 11 | { 12 | className: 'chunk', 13 | begin: '^\\*\\*\\* +\\d+,\\d+ +\\*\\*\\*\\*$', 14 | relevance: 10 15 | }, 16 | { 17 | className: 'chunk', 18 | begin: '^\\-\\-\\- +\\d+,\\d+ +\\-\\-\\-\\-$', 19 | relevance: 10 20 | }, 21 | { 22 | className: 'header', 23 | begin: 'Index: ', end: '$' 24 | }, 25 | { 26 | className: 'header', 27 | begin: '=====', end: '=====$' 28 | }, 29 | { 30 | className: 'header', 31 | begin: '^\\-\\-\\-', end: '$' 32 | }, 33 | { 34 | className: 'header', 35 | begin: '^\\*{3} ', end: '$' 36 | }, 37 | { 38 | className: 'header', 39 | begin: '^\\+\\+\\+', end: '$' 40 | }, 41 | { 42 | className: 'header', 43 | begin: '\\*{5}', end: '\\*{5}$' 44 | }, 45 | { 46 | className: 'addition', 47 | begin: '^\\+', end: '$' 48 | }, 49 | { 50 | className: 'deletion', 51 | begin: '^\\-', end: '$' 52 | }, 53 | { 54 | className: 'change', 55 | begin: '^\\!', end: '$' 56 | } 57 | ] 58 | } 59 | }; 60 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/rib.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | keywords: 5 | 'ArchiveRecord AreaLightSource Atmosphere Attribute AttributeBegin AttributeEnd Basis ' + 6 | 'Begin Blobby Bound Clipping ClippingPlane Color ColorSamples ConcatTransform Cone ' + 7 | 'CoordinateSystem CoordSysTransform CropWindow Curves Cylinder DepthOfField Detail ' + 8 | 'DetailRange Disk Displacement Display End ErrorHandler Exposure Exterior Format ' + 9 | 'FrameAspectRatio FrameBegin FrameEnd GeneralPolygon GeometricApproximation Geometry ' + 10 | 'Hider Hyperboloid Identity Illuminate Imager Interior LightSource ' + 11 | 'MakeCubeFaceEnvironment MakeLatLongEnvironment MakeShadow MakeTexture Matte ' + 12 | 'MotionBegin MotionEnd NuPatch ObjectBegin ObjectEnd ObjectInstance Opacity Option ' + 13 | 'Orientation Paraboloid Patch PatchMesh Perspective PixelFilter PixelSamples ' + 14 | 'PixelVariance Points PointsGeneralPolygons PointsPolygons Polygon Procedural Projection ' + 15 | 'Quantize ReadArchive RelativeDetail ReverseOrientation Rotate Scale ScreenWindow ' + 16 | 'ShadingInterpolation ShadingRate Shutter Sides Skew SolidBegin SolidEnd Sphere ' + 17 | 'SubdivisionMesh Surface TextureCoordinates Torus Transform TransformBegin TransformEnd ' + 18 | 'TransformPoints Translate TrimCurve WorldBegin WorldEnd', 19 | illegal: '' 23 | }, 24 | { 25 | className: 'xmlDocTag', 26 | begin: '' 27 | } 28 | ] 29 | }, 30 | hljs.C_LINE_COMMENT_MODE, 31 | hljs.C_BLOCK_COMMENT_MODE, 32 | { 33 | className: 'preprocessor', 34 | begin: '#', end: '$', 35 | keywords: 'if else elif endif define undef warning error line region endregion pragma checksum' 36 | }, 37 | { 38 | className: 'string', 39 | begin: '@"', end: '"', 40 | contains: [{begin: '""'}] 41 | }, 42 | hljs.APOS_STRING_MODE, 43 | hljs.QUOTE_STRING_MODE, 44 | hljs.C_NUMBER_MODE 45 | ] 46 | } 47 | }; 48 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/cmake.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | keywords: 'add_custom_command add_custom_target add_definitions add_dependencies ' + 6 | 'add_executable add_library add_subdirectory add_test aux_source_directory ' + 7 | 'break build_command cmake_minimum_required cmake_policy configure_file ' + 8 | 'create_test_sourcelist define_property else elseif enable_language enable_testing ' + 9 | 'endforeach endfunction endif endmacro endwhile execute_process export find_file ' + 10 | 'find_library find_package find_path find_program fltk_wrap_ui foreach function ' + 11 | 'get_cmake_property get_directory_property get_filename_component get_property ' + 12 | 'get_source_file_property get_target_property get_test_property if include ' + 13 | 'include_directories include_external_msproject include_regular_expression install ' + 14 | 'link_directories load_cache load_command macro mark_as_advanced message option ' + 15 | 'output_required_files project qt_wrap_cpp qt_wrap_ui remove_definitions return ' + 16 | 'separate_arguments set set_directory_properties set_property ' + 17 | 'set_source_files_properties set_target_properties set_tests_properties site_name ' + 18 | 'source_group string target_link_libraries try_compile try_run unset variable_watch ' + 19 | 'while build_name exec_program export_library_dependencies install_files ' + 20 | 'install_programs install_targets link_libraries make_directory remove subdir_depends ' + 21 | 'subdirs use_mangled_mesa utility_source variable_requires write_file', 22 | contains: [ 23 | { 24 | className: 'envvar', 25 | begin: '\\${', end: '}' 26 | }, 27 | hljs.HASH_COMMENT_MODE, 28 | hljs.QUOTE_STRING_MODE, 29 | hljs.NUMBER_MODE 30 | ] 31 | } 32 | }; 33 | }; -------------------------------------------------------------------------------- /docpad.coffee: -------------------------------------------------------------------------------- 1 | path = require 'path' 2 | safeps = require 'safeps' 3 | hljs = require './plugins/highlight.js' 4 | 5 | docpadConfig = { 6 | gulpArgs: ['html'] 7 | templateData: 8 | site: 9 | author: "Sergey Chikuyonok" 10 | name: "Emmet Docs & Tutorials" 11 | 12 | plugins: 13 | marked: 14 | markedOptions: 15 | sanitize: false 16 | highlight: (text, lang) -> 17 | result = if lang then hljs.highlight(lang, text) else hljs.highlightAuto(text) 18 | "#{result.value}" 19 | 20 | 21 | environments: 22 | production: 23 | gulpArgs: ['full', '--production'] 24 | 25 | events: 26 | # Extend server so it can respond to cache-reset assets 27 | serverAfter: ({server}) -> 28 | reCache = /^\/-\/.+?\// 29 | server.get reCache, (req, res, next) -> 30 | req.url = req.url.replace reCache, '/' 31 | next() 32 | 33 | # Supply headers with named anchors 34 | renderDocument: (opts) -> 35 | {extension,file} = opts 36 | 37 | if file.type is 'document' and extension is 'html' 38 | opts.content = opts.content.replace /<(h\d)(.*?)>(.+?)<\/\1>/g, (str, name, attrs, header) -> 39 | if /]*name="/.test(header) 40 | return str 41 | 42 | # strip tags 43 | # console.log header 44 | anchor = header.replace /<\/?\w+(?:\s.+?)*>/g, ''; 45 | anchor = anchor 46 | .trim() 47 | .replace(/\s+/g, '-') 48 | .replace(/[^\w\-]/g, '') 49 | .replace(/\-+$/g, '') 50 | .toLowerCase() 51 | 52 | "<#{name + attrs}>#{header}" 53 | 54 | writeAfter: (opts, next) -> 55 | config = @docpad.getConfig() 56 | rootPath = config.rootPath 57 | gulpPath = path.join(rootPath, 'node_modules', '.bin', 'gulp') 58 | command = [gulpPath].concat(config.gulpArgs or []) 59 | 60 | safeps.spawn(command, {cwd: rootPath, output: true}, next) 61 | @ 62 | } 63 | 64 | module.exports = docpadConfig -------------------------------------------------------------------------------- /plugins/highlight.js/scala.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var ANNOTATION = { 3 | className: 'annotation', begin: '@[A-Za-z]+' 4 | }; 5 | var STRING = { 6 | className: 'string', 7 | begin: 'u?r?"""', end: '"""', 8 | relevance: 10 9 | }; 10 | return { 11 | defaultMode: { 12 | keywords: 13 | 'type yield lazy override def with val var false true sealed abstract private trait ' + 14 | 'object null if for while throw finally protected extends import final return else ' + 15 | 'break new catch super class case package default try this match continue throws', 16 | contains: [ 17 | { 18 | className: 'javadoc', 19 | begin: '/\\*\\*', end: '\\*/', 20 | contains: [{ 21 | className: 'javadoctag', 22 | begin: '@[A-Za-z]+' 23 | }], 24 | relevance: 10 25 | }, 26 | hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, 27 | hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, STRING, 28 | { 29 | className: 'class', 30 | begin: '((case )?class |object |trait )', end: '({|$)', // beginWithKeyword won't work because a single "case" shouldn't start this mode 31 | illegal: ':', 32 | keywords: 'case class trait object', 33 | contains: [ 34 | { 35 | beginWithKeyword: true, 36 | keywords: 'extends with', 37 | relevance: 10 38 | }, 39 | { 40 | className: 'title', 41 | begin: hljs.UNDERSCORE_IDENT_RE 42 | }, 43 | { 44 | className: 'params', 45 | begin: '\\(', end: '\\)', 46 | contains: [ 47 | hljs.APOS_STRING_MODE, hljs.QUOTE_STRING_MODE, STRING, 48 | ANNOTATION 49 | ] 50 | } 51 | ] 52 | }, 53 | hljs.C_NUMBER_MODE, 54 | ANNOTATION 55 | ] 56 | } 57 | }; 58 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/vala.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | keywords: { 5 | keyword: 6 | // Value types 7 | 'char uchar unichar int uint long ulong short ushort int8 int16 int32 int64 uint8 ' + 8 | 'uint16 uint32 uint64 float double bool struct enum string void ' + 9 | // Reference types 10 | 'weak unowned owned ' + 11 | // Modifiers 12 | 'async signal static abstract interface override ' + 13 | // Control Structures 14 | 'while do for foreach else switch case break default return try catch ' + 15 | // Visibility 16 | 'public private protected internal ' + 17 | // Other 18 | 'using new this get set const stdout stdin stderr var', 19 | built_in: 20 | 'DBus GLib CCode Gee Object', 21 | literal: 22 | 'false true null' 23 | }, 24 | contains: [ 25 | { 26 | className: 'class', 27 | beginWithKeyword: true, end: '{', 28 | keywords: 'class interface delegate namespace', 29 | contains: [ 30 | { 31 | beginWithKeyword: true, 32 | keywords: 'extends implements' 33 | }, 34 | { 35 | className: 'title', 36 | begin: hljs.UNDERSCORE_IDENT_RE 37 | } 38 | ] 39 | }, 40 | hljs.C_LINE_COMMENT_MODE, 41 | hljs.C_BLOCK_COMMENT_MODE, 42 | { 43 | className: 'string', 44 | begin: '"""', end: '"""', 45 | relevance: 5 46 | }, 47 | hljs.APOS_STRING_MODE, 48 | hljs.QUOTE_STRING_MODE, 49 | hljs.C_NUMBER_MODE, 50 | { 51 | className: 'preprocessor', 52 | begin: '^#', end: '$', 53 | relevance: 2 54 | }, 55 | { 56 | className: 'constant', 57 | begin: ' [A-Z_]+ ', 58 | relevance: 0 59 | } 60 | ] 61 | } 62 | }; 63 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/cpp.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var CPP_KEYWORDS = { 3 | keyword: 'false int float while private char catch export virtual operator sizeof ' + 4 | 'dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace ' + 5 | 'unsigned long throw volatile static protected bool template mutable if public friend ' + 6 | 'do return goto auto void enum else break new extern using true class asm case typeid ' + 7 | 'short reinterpret_cast|10 default double register explicit signed typename try this ' + 8 | 'switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype ' + 9 | 'noexcept nullptr static_assert thread_local restrict _Bool complex', 10 | built_in: 'std string cin cout cerr clog stringstream istringstream ostringstream ' + 11 | 'auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set ' + 12 | 'unordered_map unordered_multiset unordered_multimap array shared_ptr' 13 | }; 14 | return { 15 | defaultMode: { 16 | keywords: CPP_KEYWORDS, 17 | illegal: '', 39 | keywords: CPP_KEYWORDS, 40 | relevance: 10, 41 | contains: ['self'] 42 | } 43 | ] 44 | } 45 | }; 46 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/vhdl.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | keywords: { 6 | keyword: 7 | 'abs access after alias all and architecture array assert attribute begin block ' + 8 | 'body buffer bus case component configuration constant context cover disconnect ' + 9 | 'downto default else elsif end entity exit fairness file for force function generate ' + 10 | 'generic group guarded if impure in inertial inout is label library linkage literal ' + 11 | 'loop map mod nand new next nor not null of on open or others out package port ' + 12 | 'postponed procedure process property protected pure range record register reject ' + 13 | 'release rem report restrict restrict_guarantee return rol ror select sequence ' + 14 | 'severity shared signal sla sll sra srl strong subtype then to transport type ' + 15 | 'unaffected units until use variable vmode vprop vunit wait when while with xnor xor', 16 | typename: 17 | 'boolean bit character severity_level integer time delay_length natural positive ' + 18 | 'string bit_vector file_open_kind file_open_status std_ulogic std_ulogic_vector ' + 19 | 'std_logic std_logic_vector unsigned signed boolean_vector integer_vector ' + 20 | 'real_vector time_vector' 21 | }, 22 | illegal: '{', 23 | contains: [ 24 | hljs.C_BLOCK_COMMENT_MODE, // VHDL-2008 block commenting. 25 | { 26 | className: 'comment', 27 | begin: '--', end: '$' 28 | }, 29 | hljs.QUOTE_STRING_MODE, 30 | hljs.C_NUMBER_MODE, 31 | { 32 | className: 'literal', 33 | begin: '\'(U|X|0|1|Z|W|L|H|-)\'', 34 | contains: [hljs.BACKSLASH_ESCAPE] 35 | }, 36 | { 37 | className: 'attribute', 38 | begin: '\'[A-Za-z](_?[A-Za-z0-9])*', 39 | contains: [hljs.BACKSLASH_ESCAPE] 40 | } 41 | ] 42 | } // defaultMode 43 | } // return; 44 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/vbscript.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | keywords: { 6 | keyword: 7 | 'call class const dim do loop erase execute executeglobal exit for each next function ' + 8 | 'if then else on error option explicit new private property let get public randomize ' + 9 | 'redim rem select case set stop sub while wend with end to elseif is or xor and not ' + 10 | 'class_initialize class_terminate default preserve in me byval byref step resume goto', 11 | built_in: 12 | 'lcase month vartype instrrev ubound setlocale getobject rgb getref string ' + 13 | 'weekdayname rnd dateadd monthname now day minute isarray cbool round formatcurrency ' + 14 | 'conversions csng timevalue second year space abs clng timeserial fixs len asc ' + 15 | 'isempty maths dateserial atn timer isobject filter weekday datevalue ccur isdate ' + 16 | 'instr datediff formatdatetime replace isnull right sgn array snumeric log cdbl hex ' + 17 | 'chr lbound msgbox ucase getlocale cos cdate cbyte rtrim join hour oct typename trim ' + 18 | 'strcomp int createobject loadpicture tan formatnumber mid scriptenginebuildversion ' + 19 | 'scriptengine split scriptengineminorversion cint sin datepart ltrim sqr ' + 20 | 'scriptenginemajorversion time derived eval date formatpercent exp inputbox left ascw ' + 21 | 'chrw regexp server response request cstr err', 22 | literal: 23 | 'true false null nothing empty' 24 | }, 25 | illegal: '//', 26 | contains: [ 27 | { // can’t use standard QUOTE_STRING_MODE since it’s compiled with its own escape and doesn’t use the local one 28 | className: 'string', 29 | begin: '"', end: '"', 30 | illegal: '\\n', 31 | contains: [{begin: '""'}], 32 | relevance: 0 33 | }, 34 | { 35 | className: 'comment', 36 | begin: '\'', end: '$' 37 | }, 38 | hljs.C_NUMBER_MODE 39 | ] 40 | } 41 | }; 42 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/markdown.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | contains: [ 6 | // highlight headers 7 | { 8 | className: 'header', 9 | begin: '^#{1,3}', end: '$' 10 | }, 11 | { 12 | className: 'header', 13 | begin: '^.+?\\n[=-]{2,}$' 14 | }, 15 | // inline html 16 | { 17 | begin: '<', end: '>', 18 | subLanguage: 'xml', 19 | relevance: 0 20 | }, 21 | // lists (indicators only) 22 | { 23 | className: 'bullet', 24 | begin: '^([*+-]|(\\d+\\.))\\s+' 25 | }, 26 | // strong segments 27 | { 28 | className: 'strong', 29 | begin: '[*_]{2}.+?[*_]{2}' 30 | }, 31 | // emphasis segments 32 | { 33 | className: 'emphasis', 34 | begin: '\\*.+?\\*' 35 | }, 36 | { 37 | className: 'emphasis', 38 | begin: '_.+?_', 39 | relevance: 0 40 | }, 41 | // blockquotes 42 | { 43 | className: 'blockquote', 44 | begin: '^>\\s+', end: '$' 45 | }, 46 | // code snippets 47 | { 48 | className: 'code', 49 | begin: '`.+?`' 50 | }, 51 | { 52 | className: 'code', 53 | begin: '^ ', end: '$', 54 | relevance: 0 55 | }, 56 | // horizontal rules 57 | { 58 | className: 'horizontal_rule', 59 | begin: '^-{3,}', end: '$' 60 | }, 61 | // using links - title and link 62 | { 63 | begin: '\\[.+?\\]\\(.+?\\)', 64 | returnBegin: true, 65 | contains: [ 66 | { 67 | className: 'link_label', 68 | begin: '\\[.+\\]' 69 | }, 70 | { 71 | className: 'link_url', 72 | begin: '\\(', end: '\\)', 73 | excludeBegin: true, excludeEnd: true 74 | } 75 | ] 76 | } 77 | ] 78 | } 79 | }; 80 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/lua.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var OPENING_LONG_BRACKET = '\\[=*\\['; 3 | var CLOSING_LONG_BRACKET = '\\]=*\\]'; 4 | var LONG_BRACKETS = { 5 | begin: OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET, 6 | contains: ['self'] 7 | }; 8 | var COMMENTS = [ 9 | { 10 | className: 'comment', 11 | begin: '--(?!' + OPENING_LONG_BRACKET + ')', end: '$' 12 | }, 13 | { 14 | className: 'comment', 15 | begin: '--' + OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET, 16 | contains: [LONG_BRACKETS], 17 | relevance: 10 18 | } 19 | ] 20 | return { 21 | defaultMode: { 22 | lexems: hljs.UNDERSCORE_IDENT_RE, 23 | keywords: { 24 | keyword: 25 | 'and break do else elseif end false for if in local nil not or repeat return then ' + 26 | 'true until while', 27 | built_in: 28 | '_G _VERSION assert collectgarbage dofile error getfenv getmetatable ipairs load ' + 29 | 'loadfile loadstring module next pairs pcall print rawequal rawget rawset require ' + 30 | 'select setfenv setmetatable tonumber tostring type unpack xpcall coroutine debug ' + 31 | 'io math os package string table' 32 | }, 33 | contains: COMMENTS.concat([ 34 | { 35 | className: 'function', 36 | beginWithKeyword: true, end: '\\)', 37 | keywords: 'function', 38 | contains: [ 39 | { 40 | className: 'title', 41 | begin: '([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*' 42 | }, 43 | { 44 | className: 'params', 45 | begin: '\\(', endsWithParent: true, 46 | contains: COMMENTS 47 | } 48 | ].concat(COMMENTS) 49 | }, 50 | hljs.C_NUMBER_MODE, 51 | hljs.APOS_STRING_MODE, 52 | hljs.QUOTE_STRING_MODE, 53 | { 54 | className: 'string', 55 | begin: OPENING_LONG_BRACKET, end: CLOSING_LONG_BRACKET, 56 | contains: [LONG_BRACKETS], 57 | relevance: 10 58 | } 59 | ]) 60 | } 61 | }; 62 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/r.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var IDENT_RE = '([a-zA-Z]|\\.[a-zA-Z.])[a-zA-Z0-9._]*'; 3 | 4 | return { 5 | defaultMode: { 6 | contains: [ 7 | hljs.HASH_COMMENT_MODE, 8 | { 9 | begin: IDENT_RE, 10 | lexems: IDENT_RE, 11 | keywords: { 12 | keyword: 13 | 'function if in break next repeat else for return switch while try tryCatch|10 ' + 14 | 'stop warning require library attach detach source setMethod setGeneric ' + 15 | 'setGroupGeneric setClass ...|10', 16 | literal: 17 | 'NULL NA TRUE FALSE T F Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 ' + 18 | 'NA_complex_|10' 19 | }, 20 | relevance: 0 21 | }, 22 | { 23 | // hex value 24 | className: 'number', 25 | begin: "0[xX][0-9a-fA-F]+[Li]?\\b", 26 | relevance: 0 27 | }, 28 | { 29 | // explicit integer 30 | className: 'number', 31 | begin: "\\d+(?:[eE][+\\-]?\\d*)?L\\b", 32 | relevance: 0 33 | }, 34 | { 35 | // number with trailing decimal 36 | className: 'number', 37 | begin: "\\d+\\.(?!\\d)(?:i\\b)?", 38 | relevance: 0 39 | }, 40 | { 41 | // number 42 | className: 'number', 43 | begin: "\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d*)?i?\\b", 44 | relevance: 0 45 | }, 46 | { 47 | // number with leading decimal 48 | className: 'number', 49 | begin: "\\.\\d+(?:[eE][+\\-]?\\d*)?i?\\b", 50 | relevance: 0 51 | }, 52 | 53 | { 54 | // escaped identifier 55 | begin: '`', 56 | end: '`', 57 | relevance: 0 58 | }, 59 | 60 | { 61 | className: 'string', 62 | begin: '"', 63 | end: '"', 64 | contains: [hljs.BACKSLASH_ESCAPE], 65 | relevance: 0 66 | }, 67 | { 68 | className: 'string', 69 | begin: "'", 70 | end: "'", 71 | contains: [hljs.BACKSLASH_ESCAPE], 72 | relevance: 0 73 | } 74 | ] 75 | } 76 | }; 77 | }; -------------------------------------------------------------------------------- /src/documents/actions/match-pair/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Balance 4 | menuOrder: 2 5 | --- 6 | A well-known tag balancing: searches for tag or tag's content bounds from current caret position and selects it. It will expand (outward balancing) or shrink (inward balancing) selection when called multiple times. Not every editor supports both inward and outward balancing due of some implementation issues, most editors have outward balancing only. 7 | 8 | 26 | 27 | Emmet’s tag balancing is quite unique. Unlike other implementation, this one will search tag bounds from caret’s position, not the start of the document. It means you can use tag balancer even in non-HTML documents. 28 | 29 | 52 | 53 | Note that tag matching may not work outside HTML if tag definition is assembled by concatenating strings, like this: `var cell = ''`; -------------------------------------------------------------------------------- /src/documents/abbreviations/implicit-names/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Implicit tag names 4 | menuOrder: 3 5 | --- 6 | Even with such a powerful abbreviation engine, which can expand large HTML structures from short abbreviation, writing tag names may be very tedious. 7 | 8 | In many cases you can skip typing tag names and Emmet will substitute it for you. For example, instead of `div.content` you can simply write `.content` and expand it into `
`. 9 | 10 | ## How it works 11 | 12 | When you expand abbreviation, Emmet tries to grab parent context, e.g. the HTML element, inside which you’re expanding the abbreviation. If the context was grabbed successfully, Emmet uses its name to resolve implicit names: 13 | 14 | 43 | 44 | As you can see from the example above, Emmet looks at the parent tag name every time you’re expanding the abbreviation with an implicit name. Here’s how it resolves the names for some parent elements: 45 | 46 | * `li` for `ul` and `ol` 47 | * `tr` for `table`, `tbody`, `thead` and `tfoot` 48 | * `td` for `tr` 49 | * `option` for `select` and `optgroup` 50 | 51 | Take a look at some abbreviations equivalents with implicit and explicit tag names: 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 |
`.wrap>.content``div.wrap>div.content`
`em>.info``em>span.info`
`ul>.item*3``ul>li.item*3`
`table>#row$*4>[colspan=2]``table>tr#row$*4>td[colspan=2]`
71 | 72 | -------------------------------------------------------------------------------- /plugins/highlight.js/python.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var STRINGS = [ 3 | { 4 | className: 'string', 5 | begin: '(u|b)?r?\'\'\'', end: '\'\'\'', 6 | relevance: 10 7 | }, 8 | { 9 | className: 'string', 10 | begin: '(u|b)?r?"""', end: '"""', 11 | relevance: 10 12 | }, 13 | { 14 | className: 'string', 15 | begin: '(u|r|ur)\'', end: '\'', 16 | contains: [hljs.BACKSLASH_ESCAPE], 17 | relevance: 10 18 | }, 19 | { 20 | className: 'string', 21 | begin: '(u|r|ur)"', end: '"', 22 | contains: [hljs.BACKSLASH_ESCAPE], 23 | relevance: 10 24 | }, 25 | { 26 | className: 'string', 27 | begin: '(b|br)\'', end: '\'', 28 | contains: [hljs.BACKSLASH_ESCAPE] 29 | }, 30 | { 31 | className: 'string', 32 | begin: '(b|br)"', end: '"', 33 | contains: [hljs.BACKSLASH_ESCAPE] 34 | } 35 | ].concat([ 36 | hljs.APOS_STRING_MODE, 37 | hljs.QUOTE_STRING_MODE 38 | ]); 39 | var TITLE = { 40 | className: 'title', begin: hljs.UNDERSCORE_IDENT_RE 41 | }; 42 | var PARAMS = { 43 | className: 'params', 44 | begin: '\\(', end: '\\)', 45 | contains: ['self', hljs.C_NUMBER_MODE].concat(STRINGS) 46 | }; 47 | var FUNC_CLASS_PROTO = { 48 | beginWithKeyword: true, end: ':', 49 | illegal: '[${=;\\n]', 50 | contains: [TITLE, PARAMS], 51 | relevance: 10 52 | }; 53 | 54 | return { 55 | defaultMode: { 56 | keywords: { 57 | keyword: 58 | 'and elif is global as in if from raise for except finally print import pass return ' + 59 | 'exec else break not with class assert yield try while continue del or def lambda ' + 60 | 'nonlocal|10', 61 | built_in: 62 | 'None True False Ellipsis NotImplemented' 63 | }, 64 | illegal: '(|\\?)', 65 | contains: STRINGS.concat([ 66 | hljs.HASH_COMMENT_MODE, 67 | hljs.inherit(FUNC_CLASS_PROTO, {className: 'function', keywords: 'def'}), 68 | hljs.inherit(FUNC_CLASS_PROTO, {className: 'class', keywords: 'class'}), 69 | hljs.C_NUMBER_MODE, 70 | { 71 | className: 'decorator', 72 | begin: '@', end: '$' 73 | }, 74 | { 75 | begin: '\\b(print|exec)\\(' // don’t highlight keywords-turned-functions in Python 3 76 | } 77 | ]) 78 | } 79 | }; 80 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/lisp.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var LISP_IDENT_RE = '[a-zA-Z_\\-\\+\\*\\/\\<\\=\\>\\&\\#][a-zA-Z0-9_\\-\\+\\*\\/\\<\\=\\>\\&\\#]*'; 3 | var LISP_SIMPLE_NUMBER_RE = '(\\-|\\+)?\\d+(\\.\\d+|\\/\\d+)?((d|e|f|l|s)(\\+|\\-)?\\d+)?'; 4 | var LITERAL = { 5 | className: 'literal', 6 | begin: '\\b(t{1}|nil)\\b' 7 | }; 8 | var NUMBERS = [ 9 | { 10 | className: 'number', begin: LISP_SIMPLE_NUMBER_RE 11 | }, 12 | { 13 | className: 'number', begin: '#b[0-1]+(/[0-1]+)?' 14 | }, 15 | { 16 | className: 'number', begin: '#o[0-7]+(/[0-7]+)?' 17 | }, 18 | { 19 | className: 'number', begin: '#x[0-9a-f]+(/[0-9a-f]+)?' 20 | }, 21 | { 22 | className: 'number', begin: '#c\\(' + LISP_SIMPLE_NUMBER_RE + ' +' + LISP_SIMPLE_NUMBER_RE, end: '\\)' 23 | } 24 | ] 25 | var STRING = { 26 | className: 'string', 27 | begin: '"', end: '"', 28 | contains: [hljs.BACKSLASH_ESCAPE], 29 | relevance: 0 30 | }; 31 | var COMMENT = { 32 | className: 'comment', 33 | begin: ';', end: '$' 34 | }; 35 | var VARIABLE = { 36 | className: 'variable', 37 | begin: '\\*', end: '\\*' 38 | }; 39 | var KEYWORD = { 40 | className: 'keyword', 41 | begin: '[:&]' + LISP_IDENT_RE 42 | }; 43 | var QUOTED_LIST = { 44 | begin: '\\(', end: '\\)', 45 | contains: ['self', LITERAL, STRING].concat(NUMBERS) 46 | }; 47 | var QUOTED1 = { 48 | className: 'quoted', 49 | begin: '[\'`]\\(', end: '\\)', 50 | contains: NUMBERS.concat([STRING, VARIABLE, KEYWORD, QUOTED_LIST]) 51 | }; 52 | var QUOTED2 = { 53 | className: 'quoted', 54 | begin: '\\(quote ', end: '\\)', 55 | keywords: {title: 'quote'}, 56 | contains: NUMBERS.concat([STRING, VARIABLE, KEYWORD, QUOTED_LIST]) 57 | }; 58 | var LIST = { 59 | className: 'list', 60 | begin: '\\(', end: '\\)' 61 | }; 62 | var BODY = { 63 | className: 'body', 64 | endsWithParent: true, excludeEnd: true 65 | }; 66 | LIST.contains = [{className: 'title', begin: LISP_IDENT_RE}, BODY]; 67 | BODY.contains = [QUOTED1, QUOTED2, LIST, LITERAL].concat(NUMBERS).concat([STRING, COMMENT, VARIABLE, KEYWORD]); 68 | 69 | return { 70 | case_insensitive: true, 71 | defaultMode: { 72 | illegal: '[^\\s]', 73 | contains: NUMBERS.concat([ 74 | LITERAL, 75 | STRING, 76 | COMMENT, 77 | QUOTED1, QUOTED2, 78 | LIST 79 | ]) 80 | } 81 | }; 82 | }; -------------------------------------------------------------------------------- /src/documents/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Emmet Documentation 4 | --- 5 | # Emmet — the essential toolkit for web-developers # 6 | 7 | Emmet is a web-developer’s toolkit that can greatly improve your HTML & CSS workflow: 8 | 9 | 43 | 44 | Basically, most text editors out there allow you to store and re-use commonly used code chunks, called _“snippets”_. While snippets are a good way to boost your productivity, all implementations have common pitfalls: you have to define the snippet first and you can’t extend them in runtime. 45 | 46 | Emmet takes the snippets idea to a whole new level: you can type _CSS-like_ expressions that can be dynamically parsed, and produce output depending on what you type in the abbreviation. Emmet is developed and optimised for web-developers whose workflow depends on HTML/XML and CSS, but can be used with programming languages too. 47 | 48 | Start learning Emmet with the [abbreviation syntax](/abbreviations/) and available [actions](/actions/). 49 | 50 | Download plugin for your favourite editor 51 | -------------------------------------------------------------------------------- /plugins/highlight.js/haskell.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var TYPE = { 3 | className: 'type', 4 | begin: '\\b[A-Z][\\w\']*', 5 | relevance: 0 6 | }; 7 | var CONTAINER = { 8 | className: 'container', 9 | begin: '\\(', end: '\\)', 10 | contains: [ 11 | {className: 'type', begin: '\\b[A-Z][\\w]*(\\((\\.\\.|,|\\w+)\\))?'}, 12 | {className: 'title', begin: '[_a-z][\\w\']*'} 13 | ] 14 | }; 15 | var CONTAINER2 = { 16 | className: 'container', 17 | begin: '{', end: '}', 18 | contains: CONTAINER.contains 19 | } 20 | 21 | return { 22 | defaultMode: { 23 | keywords: 24 | 'let in if then else case of where do module import hiding qualified type data ' + 25 | 'newtype deriving class instance not as foreign ccall safe unsafe', 26 | contains: [ 27 | { 28 | className: 'comment', 29 | begin: '--', end: '$' 30 | }, 31 | { 32 | className: 'preprocessor', 33 | begin: '{-#', end: '#-}' 34 | }, 35 | { 36 | className: 'comment', 37 | contains: ['self'], 38 | begin: '{-', end: '-}' 39 | }, 40 | { 41 | className: 'string', 42 | begin: '\\s+\'', end: '\'', 43 | contains: [hljs.BACKSLASH_ESCAPE], 44 | relevance: 0 45 | }, 46 | hljs.QUOTE_STRING_MODE, 47 | { 48 | className: 'import', 49 | begin: '\\bimport', end: '$', 50 | keywords: 'import qualified as hiding', 51 | contains: [CONTAINER], 52 | illegal: '\\W\\.|;' 53 | }, 54 | { 55 | className: 'module', 56 | begin: '\\bmodule', end: 'where', 57 | keywords: 'module where', 58 | contains: [CONTAINER], 59 | illegal: '\\W\\.|;' 60 | }, 61 | { 62 | className: 'class', 63 | begin: '\\b(class|instance)', end: 'where', 64 | keywords: 'class where instance', 65 | contains: [TYPE] 66 | }, 67 | { 68 | className: 'typedef', 69 | begin: '\\b(data|(new)?type)', end: '$', 70 | keywords: 'data type newtype deriving', 71 | contains: [TYPE, CONTAINER, CONTAINER2] 72 | }, 73 | hljs.C_NUMBER_MODE, 74 | { 75 | className: 'shebang', 76 | begin: '#!\\/usr\\/bin\\/env\ runhaskell', end: '$' 77 | }, 78 | TYPE, 79 | { 80 | className: 'title', begin: '^[_a-z][\\w\']*' 81 | } 82 | ] 83 | } 84 | }; 85 | }; -------------------------------------------------------------------------------- /src/documents/css-abbreviations/gradients/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Gradients 4 | menuOrder: 2 5 | --- 6 | Another hard-to-write CSS3 feature is a gradient. You have to repeat long gradient definition multiple times with different vendor prefixes. Also, if you want to cover all gradient-supported browsers, you have to use three different notations: old Webkit, currently supported (`linear-gradient(top, ...)`) and W3C-proposed (`linear-gradient(to bottom, ...)`). 7 | 8 | Usually, users prefere to use third-party GUIs to generate gradients definitions, but you can do the very same thing much faster right in your editor. 9 | 10 | Emmet has a CSS3 Gradient Generator that can do all the hard work for you: 11 | 12 | 41 | 42 | As you can see from the example above, you can type regular gradient definition as `lg(...)` (or `linear-gradient(...)`) function and expand it as an abbreviation. If you write the gradient definition as a property value, Emmet will parse it and use its name as a reference for new CSS properties. 43 | 44 | ## Fallback value 45 | 46 | In preferences, you can enable `css.gradient.fallback` option to produce a fallback `background-color` CSS property whenever a gradient definition for `background-*` CSS property is expanded. This fallback property will contain a first color from gradient definition. 47 | 48 | This option is off by default because it produces a `background-color` value that almost certainly needs to be manually updated to make sure that content is readable on this background. If you don’t really care about old browsers, you can enable this option. -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var gulp = require('gulp'); 4 | var through = require('through2'); 5 | var jsBundler = require('js-bundler'); 6 | var minifyCSS = require('gulp-minify-css'); 7 | var gzip = require('gulp-gzip'); 8 | var htmlTransform = require('html-transform'); 9 | 10 | var srcOptions = {base: './'}; 11 | var outPath = './out'; 12 | var production = process.argv.indexOf('--production') !== -1; 13 | 14 | function np(file) { 15 | return path.resolve(path.join('node_modules', file)); 16 | } 17 | 18 | gulp.task('js', function() { 19 | return gulp.src('./js/*.js', srcOptions) 20 | .pipe(jsBundler({ 21 | uglify: production, 22 | sourceMap: !production, 23 | noParse: [ 24 | np('codemirror-movie/dist/movie.js'), 25 | np('emmet-codemirror/dist/emmet.js'), 26 | np('codemirror/lib/codemirror.js') 27 | ] 28 | })) 29 | .pipe(gulp.dest(outPath)); 30 | }); 31 | 32 | gulp.task('css', function() { 33 | return gulp.src('./css/*.css', srcOptions) 34 | .pipe(minifyCSS({processImport: true})) 35 | .pipe(gulp.dest(outPath)) 36 | }); 37 | 38 | gulp.task('html', ['static'], function(next) { 39 | return gulp.src('./out/**/*.html') 40 | .pipe(htmlTransform({ 41 | transformUrl: function(url, file, ctx) { 42 | if (ctx.stats) { 43 | url = '/-/' + ctx.stats.hash + url; 44 | } 45 | return url; 46 | }, 47 | mode: 'xhtml', 48 | transform: function() { 49 | return through.obj(function(file, enc, next) { 50 | findScripNodes(file.dom).forEach(function(node) { 51 | // replace & with & since CarbonAds can’t hane entities 52 | node.attribs.src = node.attribs.src.replace(/&/g, '&'); 53 | }); 54 | next(null, file); 55 | }); 56 | } 57 | })) 58 | .pipe(gulp.dest('./out')); 59 | }); 60 | 61 | gulp.task('full', ['html'], function() { 62 | return gulp.src('./out/**/*.{html,css,js,ico}') 63 | .pipe(gzip({ 64 | threshold: '1kb', 65 | gzipOptions: {level: 7} 66 | })) 67 | .pipe(gulp.dest(outPath)); 68 | }); 69 | 70 | gulp.task('watch', function() { 71 | jsBundler.watch({sourceMap: true, uglify: false}); 72 | gulp.watch('./css/**/*.css', ['css']); 73 | gulp.watch('./js/**/*.js', ['js']); 74 | }); 75 | 76 | gulp.task('static', ['css', 'js']); 77 | gulp.task('default', ['static']); 78 | 79 | function findScripNodes(nodes, out) { 80 | out = out || []; 81 | nodes.forEach(function(node) { 82 | if (/^script$/i.test(node.name || '') && node.attribs.src) { 83 | out.push(node) 84 | } 85 | 86 | if (node.children) { 87 | findScripNodes(node.children, out); 88 | } 89 | }); 90 | 91 | return out; 92 | } -------------------------------------------------------------------------------- /plugins/highlight.js/actionscript.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*'; 3 | var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)'; 4 | 5 | var AS3_REST_ARG_MODE = { 6 | className: 'rest_arg', 7 | begin: '[.]{3}', end: IDENT_RE, 8 | relevance: 10 9 | }; 10 | var TITLE_MODE = {className: 'title', begin: IDENT_RE}; 11 | 12 | return { 13 | defaultMode: { 14 | keywords: { 15 | keyword: 'as break case catch class const continue default delete do dynamic each ' + 16 | 'else extends final finally for function get if implements import in include ' + 17 | 'instanceof interface internal is namespace native new override package private ' + 18 | 'protected public return set static super switch this throw try typeof use var void ' + 19 | 'while with', 20 | literal: 'true false null undefined' 21 | }, 22 | contains: [ 23 | hljs.APOS_STRING_MODE, 24 | hljs.QUOTE_STRING_MODE, 25 | hljs.C_LINE_COMMENT_MODE, 26 | hljs.C_BLOCK_COMMENT_MODE, 27 | hljs.C_NUMBER_MODE, 28 | { 29 | className: 'package', 30 | beginWithKeyword: true, end: '{', 31 | keywords: 'package', 32 | contains: [TITLE_MODE] 33 | }, 34 | { 35 | className: 'class', 36 | beginWithKeyword: true, end: '{', 37 | keywords: 'class interface', 38 | contains: [ 39 | { 40 | beginWithKeyword: true, 41 | keywords: 'extends implements' 42 | }, 43 | TITLE_MODE 44 | ] 45 | }, 46 | { 47 | className: 'preprocessor', 48 | beginWithKeyword: true, end: ';', 49 | keywords: 'import include' 50 | }, 51 | { 52 | className: 'function', 53 | beginWithKeyword: true, end: '[{;]', 54 | keywords: 'function', 55 | illegal: '\\S', 56 | contains: [ 57 | TITLE_MODE, 58 | { 59 | className: 'params', 60 | begin: '\\(', end: '\\)', 61 | contains: [ 62 | hljs.APOS_STRING_MODE, 63 | hljs.QUOTE_STRING_MODE, 64 | hljs.C_LINE_COMMENT_MODE, 65 | hljs.C_BLOCK_COMMENT_MODE, 66 | AS3_REST_ARG_MODE 67 | ] 68 | }, 69 | { 70 | className: 'type', 71 | begin: ':', 72 | end: IDENT_FUNC_RETURN_TYPE_RE, 73 | relevance: 10 74 | } 75 | ] 76 | } 77 | ] 78 | } 79 | } 80 | }; -------------------------------------------------------------------------------- /css/main.css: -------------------------------------------------------------------------------- 1 | @import url(assets/_normalize.css); 2 | @import url(assets/_highlight.css); 3 | @import url(assets/_preferences.css); 4 | 5 | /* CodeMirror Movie */ 6 | @import url(assets/_movie.css); 7 | @import url(../node_modules/codemirror/lib/codemirror.css); 8 | @import url(../node_modules/codemirror-movie/dist/movie.css); 9 | 10 | @import url(assets/_layout.css); 11 | 12 | .CodeMirror { 13 | font-size: 12px; 14 | background: #f5f5f5; 15 | border: 1px solid #e3e3e3; 16 | } 17 | 18 | .CodeMirror-movie { 19 | margin-bottom: 20px; 20 | position: relative; 21 | } 22 | 23 | .CodeMirror-scroll { 24 | background: #fff; 25 | } 26 | 27 | .CodeMirror-activeline-background { 28 | right: -30px; 29 | } 30 | 31 | .CodeMirror-movie_with-outline .CodeMirror-scroll { 32 | margin-right: 25%; 33 | } 34 | 35 | .CodeMirror-movie_with-outline .CodeMirror-vscrollbar { 36 | right: 25%; 37 | } 38 | 39 | .CodeMirror-outline { 40 | width: 25%; 41 | font-family: Lato, "Helvetica Neue", Helvetica, Arial, sans-serif; 42 | } 43 | 44 | .CodeMirror-tooltip strong { 45 | color: #fff; 46 | } 47 | 48 | .bsa-cpc { 49 | position: absolute; 50 | top: 15px; 51 | width: 100%; 52 | } 53 | 54 | .bsa-cpc #_default_ { 55 | position: relative; 56 | margin-bottom: 1em; 57 | padding: .5em 1em; 58 | border: dashed 1px hsl(0, 0%, 90%); 59 | background-color: #f8f8f8; 60 | font-size: 13px; 61 | line-height: 1.5; 62 | } 63 | 64 | .bsa-cpc a { 65 | font-weight: 400; 66 | } 67 | 68 | .bsa-cpc .default-ad { 69 | display: none; 70 | } 71 | 72 | .bsa-cpc ._default_ { 73 | display: inline; 74 | overflow: hidden; 75 | line-height: 1.5; 76 | } 77 | 78 | .bsa-cpc ._default_> * { 79 | vertical-align: middle; 80 | } 81 | 82 | .bsa-cpc a { 83 | color: inherit; 84 | text-decoration: none; 85 | } 86 | 87 | .bsa-cpc a:hover { 88 | color: inherit; 89 | } 90 | 91 | .bsa-cpc .default-image { 92 | display: none; 93 | } 94 | 95 | .bsa-cpc .default-title:after { 96 | content: " — "; 97 | } 98 | 99 | .bsa-cpc .default-title, 100 | .bsa-cpc .default-description { 101 | display: inline; 102 | } 103 | 104 | .bsa-cpc .default-title { 105 | position: relative; 106 | margin-left: 8px; 107 | } 108 | 109 | .bsa-cpc .default-title:before { 110 | position: relative; 111 | top: -1px; 112 | left: -8px; 113 | padding: 2px 5px; 114 | background: #4caf50; 115 | border-radius: 3px; 116 | color: #ffffff; 117 | content: "Sponsor"; 118 | text-transform: uppercase; 119 | font-size: 10px; 120 | font-family: Verdana, sans-serif; 121 | line-height: 1; 122 | } 123 | 124 | -------------------------------------------------------------------------------- /plugins/highlight.js/matlab.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | defaultMode: { 4 | keywords: { 5 | keyword: 6 | 'break case catch classdef continue else elseif end enumerated events for function ' + 7 | 'global if methods otherwise parfor persistent properties return spmd switch try while', 8 | built_in: 9 | 'sin sind sinh asin asind asinh cos cosd cosh acos acosd acosh tan tand tanh atan ' + 10 | 'atand atan2 atanh sec secd sech asec asecd asech csc cscd csch acsc acscd acsch cot ' + 11 | 'cotd coth acot acotd acoth hypot exp expm1 log log1p log10 log2 pow2 realpow reallog ' + 12 | 'realsqrt sqrt nthroot nextpow2 abs angle complex conj imag real unwrap isreal ' + 13 | 'cplxpair fix floor ceil round mod rem sign airy besselj bessely besselh besseli ' + 14 | 'besselk beta betainc betaln ellipj ellipke erf erfc erfcx erfinv expint gamma ' + 15 | 'gammainc gammaln psi legendre cross dot factor isprime primes gcd lcm rat rats perms ' + 16 | 'nchoosek factorial cart2sph cart2pol pol2cart sph2cart hsv2rgb rgb2hsv zeros ones ' + 17 | 'eye repmat rand randn linspace logspace freqspace meshgrid accumarray size length ' + 18 | 'ndims numel disp isempty isequal isequalwithequalnans cat reshape diag blkdiag tril ' + 19 | 'triu fliplr flipud flipdim rot90 find sub2ind ind2sub bsxfun ndgrid permute ipermute ' + 20 | 'shiftdim circshift squeeze isscalar isvector ans eps realmax realmin pi i inf nan ' + 21 | 'isnan isinf isfinite j why compan gallery hadamard hankel hilb invhilb magic pascal ' + 22 | 'rosser toeplitz vander wilkinson' 23 | }, 24 | illegal: '(//|"|#|/\\*|\\s+/\\w+)', 25 | contains: [ 26 | { 27 | className: 'function', 28 | beginWithKeyword: true, end: '$', 29 | keywords: 'function', 30 | contains: [ 31 | { 32 | className: 'title', 33 | begin: hljs.UNDERSCORE_IDENT_RE 34 | }, 35 | { 36 | className: 'params', 37 | begin: '\\(', end: '\\)' 38 | }, 39 | { 40 | className: 'params', 41 | begin: '\\[', end: '\\]' 42 | } 43 | ] 44 | }, 45 | { 46 | className: 'string', 47 | begin: '\'', end: '\'', 48 | contains: [hljs.BACKSLASH_ESCAPE, {begin: '\'\''}], 49 | relevance: 0 50 | }, 51 | { 52 | className: 'comment', 53 | begin: '\\%', end: '$' 54 | }, 55 | hljs.C_NUMBER_MODE 56 | ] 57 | } 58 | }; 59 | }; -------------------------------------------------------------------------------- /src/documents/actions/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: Actions 4 | menuOrder: 3 5 | --- 6 | Emmet allows you to write large HTML code blocks at speed of light using well-known CSS selectors. But it’s not the only thing that every web-developer needs: occasionally you have to _edit_ your HTML and CSS code to fix bugs and add new features. 7 | 8 | Emmet offers very unique tools that can greatly improve your editing experience: 9 | 10 |
11 |
[Expand Abbreviation](./expand-abbreviation/)
12 |
Yep, this is _the_ action that expands CSS-like abbreviations into HTML code.
13 | 14 |
[Match Tag Pair](./match-pair/)
15 |
Selects content, and/or opening and closing HTML tag name from current caret position (a.k.a “balancing”). Super-awesome implementation that _works even in non-HTML syntaxes_! Implicitly used by many Emmet actions.
16 | 17 |
[Go to Matching Pair](./go-to-pair/)
18 |
Quickly traverses between opening and closing HTML tag.
19 | 20 |
[Wrap with Abbreviation](./wrap-with-abbreviation/)
21 |
Same as “Expand Abbreviation” action but intelligently wraps selected content.
22 | 23 |
[Go to Edit Point](./go-to-edit-point/)
24 |
Quickly traverse between important HTML code points.
25 | 26 |
[Select Item](./select-item/)
27 |
Quickly select important HTML and CSS code parts.
28 | 29 |
[Toggle Comment](./toggle-comment/)
30 |
Toggles comment. Unlike basic editor’s implementations, matches HTML tag, CSS property or rule when there’s no selection.
31 | 32 |
[Split/Join Tag](./split-join-tag/)
33 |
Splits (`` → ``) or joins (`` → ``) HTML/XML tag under current caret position.
34 | 35 |
[Remove Tag](./remove-tag/)
36 |
Gracefully removes HTML/XML tag under current caret position.
37 | 38 |
[Merge Lines](./merge-lines/)
39 |
Merges selected lines into single one. With no selection, automatically matches nearest HTML tag.
40 | 41 |
[Update Image Size](./update-image-size/)
42 |
Updates matched HTML tag or CSS rule with image size, located under caret.
43 | 44 |
[Evaluate Math Expression](./evaluate-math/)
45 |
Evaluates simple math expression
46 | 47 |
[Increment/Decrement Number](./inc-dec-number/)
48 |
Increments or decrements number under current caret position with given step.
49 | 50 |
[Reflect CSS Value](./reflect-css-value/)
51 |
Automatically copies CSS value under current caret position to all vendor-prefixed variants.
52 | 53 |
[Encode/Decode Image to data:URL](./base64/)
54 |
Encodes image under caret to data:URL format and vice versa.
55 | 56 |
-------------------------------------------------------------------------------- /plugins/highlight.js/nginx.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var VARS = [ 3 | { 4 | className: 'variable', begin: '\\$\\d+' 5 | }, 6 | { 7 | className: 'variable', begin: '\\${', end: '}' 8 | }, 9 | { 10 | className: 'variable', begin: '[\\$\\@]' + hljs.UNDERSCORE_IDENT_RE 11 | } 12 | ]; 13 | var DEFAULT = { 14 | endsWithParent: true, 15 | lexems: '[a-z/_]+', 16 | keywords: { 17 | built_in: 18 | 'on off yes no true false none blocked debug info notice warn error crit ' + 19 | 'select break last permanent redirect kqueue rtsig epoll poll /dev/poll' 20 | }, 21 | relevance: 0, 22 | illegal: '=>', 23 | contains: [ 24 | hljs.HASH_COMMENT_MODE, 25 | { 26 | className: 'string', 27 | begin: '"', end: '"', 28 | contains: [hljs.BACKSLASH_ESCAPE].concat(VARS), 29 | relevance: 0 30 | }, 31 | { 32 | className: 'string', 33 | begin: "'", end: "'", 34 | contains: [hljs.BACKSLASH_ESCAPE].concat(VARS), 35 | relevance: 0 36 | }, 37 | { 38 | className: 'url', 39 | begin: '([a-z]+):/', end: '\\s', endsWithParent: true, excludeEnd: true 40 | }, 41 | { 42 | className: 'regexp', 43 | begin: "\\s\\^", end: "\\s|{|;", returnEnd: true, 44 | contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) 45 | }, 46 | // regexp locations (~, ~*) 47 | { 48 | className: 'regexp', 49 | begin: "~\\*?\\s+", end: "\\s|{|;", returnEnd: true, 50 | contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) 51 | }, 52 | // *.example.com 53 | { 54 | className: 'regexp', 55 | begin: "\\*(\\.[a-z\\-]+)+", 56 | contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) 57 | }, 58 | // sub.example.* 59 | { 60 | className: 'regexp', 61 | begin: "([a-z\\-]+\\.)+\\*", 62 | contains: [hljs.BACKSLASH_ESCAPE].concat(VARS) 63 | }, 64 | // IP 65 | { 66 | className: 'number', 67 | begin: '\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b' 68 | }, 69 | // units 70 | { 71 | className: 'number', 72 | begin: '\\b\\d+[kKmMgGdshdwy]*\\b', 73 | relevance: 0 74 | } 75 | ].concat(VARS) 76 | }; 77 | 78 | return { 79 | defaultMode: { 80 | contains: [ 81 | hljs.HASH_COMMENT_MODE, 82 | { 83 | begin: hljs.UNDERSCORE_IDENT_RE + '\\s', end: ';|{', returnBegin: true, 84 | contains: [ 85 | { 86 | className: 'title', 87 | begin: hljs.UNDERSCORE_IDENT_RE, 88 | starts: DEFAULT 89 | } 90 | ] 91 | } 92 | ], 93 | illegal: '[^\\s\\}]' 94 | } 95 | }; 96 | }; -------------------------------------------------------------------------------- /src/documents/abbreviations/lorem-ipsum/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: page 3 | title: “Lorem Ipsum” generator 4 | menuOrder: 4 5 | --- 6 | [“Lorem ipsum”](http://www.lipsum.com) dummy text is used by many web-developers to test how their HTML templates will look with real data. Often, developers use third-party services to generate “Lorem ipsum” text, but now you can do that right in your editor. Just expand `lorem` or `lipsum` abbreviations to get the following snippet: 7 | 8 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eligendi non quis exercitationem culpa nesciunt nihil aut nostrum explicabo reprehenderit optio amet ab temporibus asperiores quasi cupiditate. Voluptatum ducimus voluptates voluptas? 9 | 10 | `lorem` is not just a normal snippet—it’s actually a _generator_. Every time you expand it, it will generate a 30-words dummy text, splitted into a few sentences. 11 | 12 | You can specify how many words should be generated right in the abbreviation. For example, `lorem100` will generate a 100-words dummy text. 13 | 14 | ## Repeated “Lorem ipsum” 15 | 16 | You can use `lorem` generator inside repeated elements to create tags filled with completely random sentences. For example, `p*4>lorem` abbreviation would generate something like this: 17 | 18 |

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Qui dicta minus molestiae vel beatae natus eveniet ratione temporibus aperiam harum alias officiis assumenda officia quibusdam deleniti eos cupiditate dolore doloribus!

19 |

Ad dolore dignissimos asperiores dicta facere optio quod commodi nam tempore recusandae. Rerum sed nulla eum vero expedita ex delectus voluptates rem at neque quos facere sequi unde optio aliquam!

20 |

Tenetur quod quidem in voluptatem corporis dolorum dicta sit pariatur porro quaerat autem ipsam odit quam beatae tempora quibusdam illum! Modi velit odio nam nulla unde amet odit pariatur at!

21 |

Consequatur rerum amet fuga expedita sunt et tempora saepe? Iusto nihil explicabo perferendis quos provident delectus ducimus necessitatibus reiciendis optio tempora unde earum doloremque commodi laudantium ad nulla vel odio?

22 | 23 | Also, `lorem` generator utilizes the [implicit tag name resolver](/abbreviations/implicit-names/) when `lorem` element is self-repeated so you can shorten your abbreviations: 24 | 25 | `ul.generic-list>lorem10.item*4` 26 | 27 | ...will produce 28 | 29 | 35 | 36 | -------------------------------------------------------------------------------- /plugins/highlight.js/avrasm.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | return { 3 | case_insensitive: true, 4 | defaultMode: { 5 | keywords: { 6 | keyword: 7 | /* mnemonic */ 8 | 'adc add adiw and andi asr bclr bld brbc brbs brcc brcs break breq brge brhc brhs ' + 9 | 'brid brie brlo brlt brmi brne brpl brsh brtc brts brvc brvs bset bst call cbi cbr ' + 10 | 'clc clh cli cln clr cls clt clv clz com cp cpc cpi cpse dec eicall eijmp elpm eor ' + 11 | 'fmul fmuls fmulsu icall ijmp in inc jmp ld ldd ldi lds lpm lsl lsr mov movw mul ' + 12 | 'muls mulsu neg nop or ori out pop push rcall ret reti rjmp rol ror sbc sbr sbrc sbrs ' + 13 | 'sec seh sbi sbci sbic sbis sbiw sei sen ser ses set sev sez sleep spm st std sts sub ' + 14 | 'subi swap tst wdr', 15 | built_in: 16 | /* general purpose registers */ 17 | 'r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11 r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 ' + 18 | 'r23 r24 r25 r26 r27 r28 r29 r30 r31 x|0 xh xl y|0 yh yl z|0 zh zl ' + 19 | /* IO Registers (ATMega128) */ 20 | 'ucsr1c udr1 ucsr1a ucsr1b ubrr1l ubrr1h ucsr0c ubrr0h tccr3c tccr3a tccr3b tcnt3h ' + 21 | 'tcnt3l ocr3ah ocr3al ocr3bh ocr3bl ocr3ch ocr3cl icr3h icr3l etimsk etifr tccr1c ' + 22 | 'ocr1ch ocr1cl twcr twdr twar twsr twbr osccal xmcra xmcrb eicra spmcsr spmcr portg ' + 23 | 'ddrg ping portf ddrf sreg sph spl xdiv rampz eicrb eimsk gimsk gicr eifr gifr timsk ' + 24 | 'tifr mcucr mcucsr tccr0 tcnt0 ocr0 assr tccr1a tccr1b tcnt1h tcnt1l ocr1ah ocr1al ' + 25 | 'ocr1bh ocr1bl icr1h icr1l tccr2 tcnt2 ocr2 ocdr wdtcr sfior eearh eearl eedr eecr ' + 26 | 'porta ddra pina portb ddrb pinb portc ddrc pinc portd ddrd pind spdr spsr spcr udr0 ' + 27 | 'ucsr0a ucsr0b ubrr0l acsr admux adcsr adch adcl porte ddre pine pinf' 28 | }, 29 | contains: [ 30 | hljs.C_BLOCK_COMMENT_MODE, 31 | {className: 'comment', begin: ';', end: '$'}, 32 | hljs.C_NUMBER_MODE, // 0x..., decimal, float 33 | hljs.BINARY_NUMBER_MODE, // 0b... 34 | { 35 | className: 'number', 36 | begin: '\\b(\\$[a-zA-Z0-9]+|0o[0-7]+)' // $..., 0o... 37 | }, 38 | hljs.QUOTE_STRING_MODE, 39 | { 40 | className: 'string', 41 | begin: '\'', end: '[^\\\\]\'', 42 | illegal: '[^\\\\][^\']' 43 | }, 44 | {className: 'label', begin: '^[A-Za-z0-9_.$]+:'}, 45 | {className: 'preprocessor', begin: '#', end: '$'}, 46 | { // директивы «.include» «.macro» и т.д. 47 | className: 'preprocessor', 48 | begin: '\\.[a-zA-Z]+' 49 | }, 50 | { // подстановка в «.macro» 51 | className: 'localvars', 52 | begin: '@[0-9]+' 53 | } 54 | ] 55 | } 56 | }; 57 | }; -------------------------------------------------------------------------------- /plugins/highlight.js/delphi.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var DELPHI_KEYWORDS = 'and safecall cdecl then string exports library not pascal set ' + 3 | 'virtual file in array label packed end. index while const raise for to implementation ' + 4 | 'with except overload destructor downto finally program exit unit inherited override if ' + 5 | 'type until function do begin repeat goto nil far initialization object else var uses ' + 6 | 'external resourcestring interface end finalization class asm mod case on shr shl of ' + 7 | 'register xorwrite threadvar try record near stored constructor stdcall inline div out or ' + 8 | 'procedure'; 9 | var DELPHI_CLASS_KEYWORDS = 'safecall stdcall pascal stored const implementation ' + 10 | 'finalization except to finally program inherited override then exports string read not ' + 11 | 'mod shr try div shl set library message packed index for near overload label downto exit ' + 12 | 'public goto interface asm on of constructor or private array unit raise destructor var ' + 13 | 'type until function else external with case default record while protected property ' + 14 | 'procedure published and cdecl do threadvar file in if end virtual write far out begin ' + 15 | 'repeat nil initialization object uses resourcestring class register xorwrite inline static'; 16 | var CURLY_COMMENT = { 17 | className: 'comment', 18 | begin: '{', end: '}', 19 | relevance: 0 20 | }; 21 | var PAREN_COMMENT = { 22 | className: 'comment', 23 | begin: '\\(\\*', end: '\\*\\)', 24 | relevance: 10 25 | }; 26 | var STRING = { 27 | className: 'string', 28 | begin: '\'', end: '\'', 29 | contains: [{begin: '\'\''}], 30 | relevance: 0 31 | }; 32 | var CHAR_STRING = { 33 | className: 'string', begin: '(#\\d+)+' 34 | }; 35 | var FUNCTION = { 36 | className: 'function', 37 | beginWithKeyword: true, end: '[:;]', 38 | keywords: 'function constructor|10 destructor|10 procedure|10', 39 | contains: [ 40 | { 41 | className: 'title', begin: hljs.IDENT_RE 42 | }, 43 | { 44 | className: 'params', 45 | begin: '\\(', end: '\\)', 46 | keywords: DELPHI_KEYWORDS, 47 | contains: [STRING, CHAR_STRING] 48 | }, 49 | CURLY_COMMENT, PAREN_COMMENT 50 | ] 51 | }; 52 | return { 53 | case_insensitive: true, 54 | defaultMode: { 55 | keywords: DELPHI_KEYWORDS, 56 | illegal: '("|\\$[G-Zg-z]|\\/\\*| 39 |
40 | Watch demo 41 |
42 | `); 43 | 44 | splash.addEventListener('click', evt => movie.play()); 45 | var removeSplash = () => removeElem(splash); 46 | 47 | movie.on('play', removeSplash); 48 | 49 | // create toolbar 50 | var btnPlay = toDom(``); 51 | btnPlay.addEventListener('click', evt => movie.toggle()); 52 | 53 | var btnTry = toDom(``); 54 | btnTry.addEventListener('click', evt => { 55 | movie.stop(); 56 | removeSplash(); 57 | editor.setOption('readOnly', false); 58 | editor.execCommand('revert'); 59 | editor.focus(); 60 | }); 61 | 62 | var toolbar = toDom('
'); 63 | toolbar.appendChild(btnPlay); 64 | toolbar.appendChild(btnTry); 65 | 66 | movie 67 | .on('play resume', () => btnPlay.innerText = buttonLabels.pause) 68 | .on('pause stop', () => btnPlay.innerText = buttonLabels.play_again); 69 | 70 | var wrapper = editor.getWrapperElement(); 71 | wrapper.appendChild(splash); 72 | wrapper.parentNode.insertBefore(toolbar, wrapper); 73 | } 74 | 75 | export function setupEditor(elem) { 76 | var editor = CodeMirror.fromTextArea(elem, extend({ 77 | mode : elem.getAttribute('data-cm-mode') || 'text/html', 78 | }, codeMirrorOptions)); 79 | var height = elem.getAttribute('data-height'); 80 | if (height) { 81 | editor.getWrapperElement().style.height = height + 'px'; 82 | } 83 | EmmetCodemirror(editor); 84 | } 85 | 86 | $('.movie-def').forEach(setupMovie); 87 | $('.emmet-preferences').forEach(preferences); 88 | $('.cm-box').forEach(setupEditor); -------------------------------------------------------------------------------- /plugins/highlight.js/xml.js: -------------------------------------------------------------------------------- 1 | module.exports = function(hljs) { 2 | var XML_IDENT_RE = '[A-Za-z0-9\\._:-]+'; 3 | var TAG_INTERNALS = { 4 | endsWithParent: true, 5 | contains: [ 6 | { 7 | className: 'attribute', 8 | begin: XML_IDENT_RE, 9 | relevance: 0 10 | }, 11 | { 12 | begin: '="', returnBegin: true, end: '"', 13 | contains: [{ 14 | className: 'value', 15 | begin: '"', endsWithParent: true 16 | }] 17 | }, 18 | { 19 | begin: '=\'', returnBegin: true, end: '\'', 20 | contains: [{ 21 | className: 'value', 22 | begin: '\'', endsWithParent: true 23 | }] 24 | }, 25 | { 26 | begin: '=', 27 | contains: [{ 28 | className: 'value', 29 | begin: '[^\\s/>]+' 30 | }] 31 | } 32 | ] 33 | }; 34 | return { 35 | case_insensitive: true, 36 | defaultMode: { 37 | contains: [ 38 | { 39 | className: 'pi', 40 | begin: '<\\?', end: '\\?>', 41 | relevance: 10 42 | }, 43 | { 44 | className: 'doctype', 45 | begin: '', 46 | relevance: 10, 47 | contains: [{begin: '\\[', end: '\\]'}] 48 | }, 49 | { 50 | className: 'comment', 51 | begin: '', 52 | relevance: 10 53 | }, 54 | { 55 | className: 'cdata', 56 | begin: '<\\!\\[CDATA\\[', end: '\\]\\]>', 57 | relevance: 10 58 | }, 59 | { 60 | className: 'tag', 61 | /* 62 | The lookahead pattern (?=...) ensures that 'begin' only matches 63 | '|$)', end: '>', 68 | keywords: {title: 'style'}, 69 | contains: [TAG_INTERNALS], 70 | starts: { 71 | end: '', returnEnd: true, 72 | subLanguage: 'css' 73 | } 74 | }, 75 | { 76 | className: 'tag', 77 | // See the comment in the