├── .editorconfig ├── .eshintignore ├── .eslintrc ├── .gitignore ├── .npmignore ├── .travis.yml ├── CHANGELOG.md ├── README.md ├── assets ├── anchor.js ├── anchor.min.js ├── examples.js ├── interact.min.js ├── logo.png ├── mdcss-logo.png ├── octicons │ ├── octicons-local.ttf │ ├── octicons.css │ ├── octicons.eot │ ├── octicons.svg │ ├── octicons.ttf │ └── octicons.woff ├── primer.css ├── prism.js ├── script.js └── style.css ├── demo ├── anchor.js ├── anchor.min.js ├── examples.js ├── index.html ├── interact.min.js ├── logo.png ├── mdcss-logo.png ├── octicons │ ├── octicons-local.ttf │ ├── octicons.css │ ├── octicons.eot │ ├── octicons.svg │ ├── octicons.ttf │ └── octicons.woff ├── primer.css ├── prism.js ├── script.js └── style.css ├── index.js ├── package.json ├── template.ejs ├── test.js └── watch.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | end_of_line = lf 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.{css,md}] 11 | trim_trailing_whitespace = false 12 | 13 | [*.{json,yml}] 14 | indent_size = 2 15 | -------------------------------------------------------------------------------- /.eshintignore: -------------------------------------------------------------------------------- 1 | assets/ 2 | demo/ 3 | node_modules/ 4 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-shadow-restricted-names": [2], 4 | "computed-property-spacing": [2], 5 | "no-empty-character-class": [2], 6 | "no-irregular-whitespace": [2], 7 | "no-unexpected-multiline": [2], 8 | "no-multiple-empty-lines": [2], 9 | "space-return-throw-case": [2], 10 | "no-constant-condition": [2], 11 | "no-extra-boolean-cast": [2], 12 | "no-inner-declarations": [2], 13 | "no-this-before-super": [2], 14 | "no-array-constructor": [2], 15 | "object-curly-spacing": [2, "always"], 16 | "no-floating-decimal": [2], 17 | "no-warning-comments": [2], 18 | "handle-callback-err": [2], 19 | "no-unneeded-ternary": [2], 20 | "operator-assignment": [2], 21 | "space-before-blocks": [2], 22 | "no-native-reassign": [2], 23 | "no-trailing-spaces": [2], 24 | "operator-linebreak": [2, "after"], 25 | "consistent-return": [2], 26 | "no-duplicate-case": [2], 27 | "no-invalid-regexp": [2], 28 | "no-negated-in-lhs": [2], 29 | "constructor-super": [2], 30 | "no-nested-ternary": [0], 31 | "no-extend-native": [2], 32 | "block-scoped-var": [2], 33 | "no-control-regex": [2], 34 | "no-sparse-arrays": [2], 35 | "no-throw-literal": [2], 36 | "no-return-assign": [2], 37 | "no-const-assign": [2], 38 | "no-class-assign": [2], 39 | "no-extra-parens": [2], 40 | "no-regex-spaces": [2], 41 | "no-implied-eval": [2], 42 | "no-useless-call": [2], 43 | "no-self-compare": [2], 44 | "no-octal-escape": [2], 45 | "no-new-wrappers": [2], 46 | "no-process-exit": [2], 47 | "no-catch-shadow": [2], 48 | "linebreak-style": [2], 49 | "space-infix-ops": [2], 50 | "space-unary-ops": [2], 51 | "no-func-assign": [2], 52 | "no-unreachable": [2], 53 | "accessor-pairs": [2], 54 | "no-empty-label": [2], 55 | "no-fallthrough": [2], 56 | "no-path-concat": [2], 57 | "no-new-require": [2], 58 | "no-spaced-func": [2], 59 | "no-unused-vars": [2], 60 | "spaced-comment": [2], 61 | "no-delete-var": [2], 62 | "comma-spacing": [2], 63 | "no-extra-semi": [2], 64 | "no-extra-bind": [2], 65 | "arrow-spacing": [2], 66 | "prefer-spread": [2], 67 | "no-new-object": [2], 68 | "no-multi-str": [2], 69 | "semi-spacing": [2], 70 | "no-lonely-if": [2], 71 | "dot-notation": [2], 72 | "dot-location": [2, "property"], 73 | "comma-dangle": [2, "never"], 74 | "no-dupe-args": [2], 75 | "no-dupe-keys": [2], 76 | "no-ex-assign": [2], 77 | "no-obj-calls": [2], 78 | "valid-typeof": [2], 79 | "default-case": [2], 80 | "no-redeclare": [2], 81 | "no-div-regex": [2], 82 | "no-sequences": [2], 83 | "no-label-var": [2], 84 | "comma-style": [2], 85 | "brace-style": [2], 86 | "no-debugger": [2], 87 | "quote-props": [0], 88 | "no-iterator": [2], 89 | "no-new-func": [2], 90 | "key-spacing": [2, { "align": "value" }], 91 | "complexity": [2], 92 | "new-parens": [2], 93 | "no-eq-null": [2], 94 | "no-bitwise": [0], 95 | "wrap-iife": [2], 96 | "no-caller": [2], 97 | "use-isnan": [2], 98 | "no-labels": [2], 99 | "no-shadow": [2], 100 | "camelcase": [2], 101 | "eol-last": [2], 102 | "no-octal": [2], 103 | "no-empty": [2], 104 | "no-alert": [2], 105 | "no-proto": [2], 106 | "no-undef": [2], 107 | "no-eval": [2], 108 | "no-with": [2], 109 | "no-void": [2], 110 | "new-cap": [2], 111 | "eqeqeq": [2], 112 | "no-new": [2], 113 | "quotes": [2, "single"], 114 | "indent": [2, "tab"], 115 | "semi": [2, "always"], 116 | "yoda": [2, "never"] 117 | }, 118 | "env": { 119 | "mocha": true, 120 | "node": true 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | npm-debug.log 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - stable 5 | - "0.12" 6 | branches: 7 | only: 8 | - gh-pages 9 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | This project adheres to [Semantic Versioning](http://semver.org/). 4 | 5 | ## [Unreleased] 6 | 7 | ## [2.4.2] 2016-06-23 8 | 9 | ## Fixed 10 | - iFrame class 11 | 12 | ## [2.4.1] 2016-06-23 13 | 14 | ## Added 15 | - anchor.js 16 | - interact.js 17 | - Beginnings of responsive examples 18 | 19 | ## Changed 20 | - octicons location 21 | - primer.css 22 | - example markup 23 | 24 | ## [2.4.0] 2016-06-20 25 | 26 | ## Added 27 | - Google Analytics option 28 | - Masthead color option 29 | - Query string caching 30 | - New change log format 31 | 32 | ## Changed 33 | - Swatch styles 34 | 35 | ## Removed 36 | - Figure element from examples 37 | 38 | ## [2.3.0] 2016-05-24 39 | 40 | ## Changed 41 | - Theme now uses PrimerCSS 42 | - All markup to match Primer class names 43 | 44 | ## [2.2.0] 2016-01-29 45 | 46 | ## Added 47 | - Expand shorthand hex 48 | - Sortable sections using `order: ` 49 | 50 | ## Changed 51 | - Package dependencies 52 | 53 | ## [2.1.0] 2016-01-26 54 | 55 | ## Added 56 | - Option to define the CSS files used by theme 57 | 58 | ## Changed 59 | - Documentation 60 | - Package dependencies 61 | 62 | ## [2.0.1] 2015-11-18 63 | 64 | ## Changed 65 | - Options are merged rather than split 66 | - Documentation 67 | 68 | ## [2.0.0] 2015-11-17 69 | 70 | ## Added 71 | - Added: Options to control example 72 | 73 | ## Changed 74 | - Examples syntax 75 | - Documentation 76 | - mdcss logo 77 | 78 | ## [1.3.4] 2015-11-09 79 | 80 | ## Changed 81 | - Improvements to iframe resizing 82 | 83 | ## [1.3.3] 2015-11-09 84 | 85 | ## Changed 86 | - Use mdcss 1.2.0 87 | - Use `textContent` to read examples in Firefox 88 | 89 | ## [1.3.2] 2015-11-09 90 | 91 | ## Changed 92 | - Improvements to iframe resizing 93 | 94 | ## [1.3.1] 2015-11-09 95 | 96 | ## Changed 97 | - Example iframes use transparent background 98 | 99 | ## [1.3.0] 2015-11-09 100 | 101 | ## Added 102 | - Option to specify `exampleCSS` file used by examples 103 | 104 | ## [1.2.1] 2015-11-04 105 | 106 | ## Added 107 | - Last updated footer 108 | 109 | ## Changed 110 | - Watch functionality 111 | 112 | ## [1.2.0] 2015-11-04 113 | 114 | ## Added 115 | - `color_example` code block 116 | - `npm run watch` development mode 117 | 118 | ## Changed 119 | - Documentation 120 | 121 | ## [1.0.1] 2015-10-30 122 | 123 | ## Removed 124 | - `fs-wishlist` dependency 125 | 126 | ## [1.0.0] 2015-10-30 127 | 128 | ## Added 129 | - Initial release 130 | 131 | [Unreleased]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.4.2...HEAD 132 | [2.4.2]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.4.1...2.4.2 133 | [2.4.1]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.4.0...2.4.1 134 | [2.4.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.3.0...2.4.0 135 | [2.3.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.2.0...2.3.0 136 | [2.2.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.1.0...2.2.0 137 | [2.1.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.0.1...2.1.0 138 | [2.0.1]: https://github.com/jonathantneal/mdcss-theme-github/compare/2.0.0...2.0.1 139 | [2.0.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.3.4...2.0.0 140 | [1.3.4]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.3.3...1.3.4 141 | [1.3.3]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.3.2...1.3.3 142 | [1.3.2]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.3.1...1.3.2 143 | [1.3.1]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.3.0...1.3.1 144 | [1.3.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.2.1...1.3.0 145 | [1.2.1]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.2.0...1.2.1 146 | [1.2.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.1.1...1.2.0 147 | [1.1.1]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.1.0...1.1.1 148 | [1.1.0]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.0.1...1.1.0 149 | [1.0.1]: https://github.com/jonathantneal/mdcss-theme-github/compare/1.0.0...1.0.1 150 | [1.0.0]: https://github.com/jonathantneal/mdcss-theme-github/commits/1.0.0 151 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mdcss GitHub 2 | 3 | 4 | 5 | [![NPM Version][npm-img]][npm] [![Build Status][ci-img]][ci] 6 | 7 | [mdcss GitHub] is a theme for [mdcss] based on the documentation styles seen across GitHub. 8 | 9 | ## Usage 10 | 11 | Add [mdcss] and [mdcss GitHub] to your build tool: 12 | 13 | ```bash 14 | npm install mdcss mdcss-theme-github --save-dev 15 | ``` 16 | 17 | Whenever [mdcss] is used, reference this theme. 18 | 19 | ```js 20 | require('mdcss')({ 21 | theme: require('mdcss-theme-github')({ /* options */ }) 22 | }) 23 | ``` 24 | 25 | ## Features 26 | 27 | #### Example 28 | 29 | The `example` keyword is used to render living examples of code in iframes. 30 | 31 | ```example 32 | 33 | ``` 34 | 35 | Specifying a language like `example:html` generates an example that is then followed by the original code block. 36 | 37 | ```example:html 38 | 39 | ``` 40 | 41 | #### Color 42 | 43 | The `color` keyword is used to generate a visual palette of colors. Arguments that follow `@name: value` may be used to provide any additional details about a color. 44 | 45 | ```example:color 46 | @color: #ffffff @name: White 47 | @color: #f8f8f8 @name: White Smoke 48 | @color: #e7e7e7 @name: Whisper 49 | @color: #777777 @name: Grey 50 | @color: #565454 @name: Matterhorn 51 | @color: #4078c0 @name: Steel Blue 52 | @color: #333333 @name: Night Rider 53 | ``` 54 | 55 | #### Order 56 | 57 | The `order` heading detail is used to control the order of sections in the generated style guide. A negative order value will shift the item before non-ordered items, while a positive order value will push the item after non-ordered values. 58 | 59 | ```css 60 | /*--- 61 | section: First Section 62 | order: -1 63 | --- 64 | ``` 65 | 66 | Attached to a subsection, the order detail will control the position of the subsection inside the section. 67 | 68 | ```css 69 | /*--- 70 | title: Last Subsection 71 | section: Third Section 72 | order: 1 73 | --- 74 | ``` 75 | 76 | 77 | ## Options 78 | 79 | Options control the look and feel of the [mdcss GitHub] theme as well as any iframe examples that may be used. 80 | 81 | #### `title` 82 | 83 | Type: `String` 84 | Default: `'Style Guide'` 85 | 86 | The page title to be used by the style guide. 87 | 88 | #### `logo` 89 | 90 | Type: `String` 91 | Default: `'mdcss-logo.png'` 92 | 93 | 94 | 95 | The page logo to be used by the style guide. 96 | 97 | #### `css` 98 | 99 | Type: `Array` 100 | Default: `['style.css']` 101 | 102 | A list of CSS files to be used by the theme. 103 | 104 | #### `js` 105 | 106 | Type: `Array` 107 | Default: `[]` 108 | 109 | A list of JavaScript files to be used by the theme. 110 | 111 | #### `examples.base` 112 | 113 | Type: `String` 114 | Default: `null` 115 | 116 | The base URL to use for all relative URLs contained within an example, 117 | including CSS and JavaScript references. 118 | 119 | #### `examples.target` 120 | 121 | Type: `String` 122 | Default: `'_self'` 123 | 124 | The frame to open example hyperlinks from within an example. 125 | 126 | #### `examples.css` 127 | 128 | Type: `Array` 129 | Default: `['style.css']` 130 | 131 | A list of CSS files to be used by examples. 132 | 133 | #### `examples.js` 134 | 135 | Type: `Array` 136 | Default: `null` 137 | 138 | A list of JavaScript files to be used by examples. 139 | 140 | #### `examples.bodyjs` 141 | 142 | Type: `Array` 143 | Default: `null` 144 | 145 | A list of JavaScript files to be used by examples, inserted after the example. 146 | 147 | #### `examples.htmlcss` 148 | 149 | Type: `String` 150 | Default: `'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:0;position:static;width:auto'` 151 | 152 | A string of styles applied to the `` wrapping the example. These default styles are used to create a seamless effect with the styleguide. 153 | 154 | #### `examples.bodycss` 155 | 156 | Type: `String` 157 | Default: `'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:16px;position:static;width:auto'` 158 | 159 | A string of styles applied to the `` wrapping the example. These default styles are used to create a seamless effect with the styleguide. 160 | 161 | [ci]: https://travis-ci.org/jonathantneal/mdcss-theme-github 162 | [ci-img]: https://img.shields.io/travis/jonathantneal/mdcss-theme-github.svg 163 | [npm]: https://www.npmjs.com/package/mdcss-theme-github 164 | [npm-img]: https://img.shields.io/npm/v/mdcss-theme-github.svg 165 | [mdcss]: https://github.com/jonathantneal/mdcss 166 | 167 | [mdcss GitHub]: https://github.com/jonathantneal/mdcss-theme-github 168 | -------------------------------------------------------------------------------- /assets/anchor.js: -------------------------------------------------------------------------------- 1 | /** 2 | * AnchorJS - v3.2.0 - 2016-06-10 3 | * https://github.com/bryanbraun/anchorjs 4 | * Copyright (c) 2016 Bryan Braun; Licensed MIT 5 | */ 6 | 7 | /* eslint-env amd, node */ 8 | 9 | 'use strict'; 10 | 11 | // https://github.com/umdjs/umd/blob/master/templates/returnExports.js 12 | (function (root, factory) { 13 | if (typeof define === 'function' && define.amd) { 14 | // AMD. Register as an anonymous module. 15 | define([], factory); 16 | } else if (typeof module === 'object' && module.exports) { 17 | // Node. Does not work with strict CommonJS, but 18 | // only CommonJS-like environments that support module.exports, 19 | // like Node. 20 | module.exports = factory(); 21 | } else { 22 | // Browser globals (root is window) 23 | root.AnchorJS = factory(); 24 | root.anchors = new root.AnchorJS(); 25 | } 26 | }(this, function () { 27 | 28 | function AnchorJS(options) { 29 | this.options = options || {}; 30 | this.elements = []; 31 | 32 | /** 33 | * Assigns options to the internal options object, and provides defaults. 34 | * @param {Object} opts - Options object 35 | */ 36 | function _applyRemainingDefaultOptions(opts) { 37 | opts.icon = opts.hasOwnProperty('icon') ? opts.icon : '\ue9cb'; // Accepts characters (and also URLs?), like '#', '¶', '❡', or '§'. 38 | opts.visible = opts.hasOwnProperty('visible') ? opts.visible : 'hover'; // Also accepts 'always' & 'touch' 39 | opts.placement = opts.hasOwnProperty('placement') ? opts.placement : 'right'; // Also accepts 'left' 40 | opts.class = opts.hasOwnProperty('class') ? opts.class : ''; // Accepts any class name. 41 | // Using Math.floor here will ensure the value is Number-cast and an integer. 42 | opts.truncate = opts.hasOwnProperty('truncate') ? Math.floor(opts.truncate) : 64; // Accepts any value that can be typecast to a number. 43 | } 44 | 45 | _applyRemainingDefaultOptions(this.options); 46 | 47 | /** 48 | * Checks to see if this device supports touch. Uses criteria pulled from Modernizr: 49 | * https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40 50 | * @return {Boolean} - true if the current device supports touch. 51 | */ 52 | this.isTouchDevice = function() { 53 | return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch); 54 | }; 55 | 56 | /** 57 | * Add anchor links to page elements. 58 | * @param {String|Array|Nodelist} selector - A CSS selector for targeting the elements you wish to add anchor links 59 | * to. Also accepts an array or nodeList containing the relavant elements. 60 | * @return {this} - The AnchorJS object 61 | */ 62 | this.add = function(selector) { 63 | var elements, 64 | elsWithIds, 65 | idList, 66 | elementID, 67 | i, 68 | index, 69 | count, 70 | tidyText, 71 | newTidyText, 72 | readableID, 73 | anchor, 74 | visibleOptionToUse, 75 | indexesToDrop = []; 76 | 77 | // We reapply options here because somebody may have overwritten the default options object when setting options. 78 | // For example, this overwrites all options but visible: 79 | // 80 | // anchors.options = { visible: 'always'; } 81 | _applyRemainingDefaultOptions(this.options); 82 | 83 | visibleOptionToUse = this.options.visible; 84 | if (visibleOptionToUse === 'touch') { 85 | visibleOptionToUse = this.isTouchDevice() ? 'always' : 'hover'; 86 | } 87 | 88 | // Provide a sensible default selector, if none is given. 89 | if (!selector) { 90 | selector = 'h1, h2, h3, h4, h5, h6'; 91 | } 92 | 93 | elements = _getElements(selector); 94 | 95 | if (elements.length === 0) { 96 | return false; 97 | } 98 | 99 | _addBaselineStyles(); 100 | 101 | // We produce a list of existing IDs so we don't generate a duplicate. 102 | elsWithIds = document.querySelectorAll('[id]'); 103 | idList = [].map.call(elsWithIds, function assign(el) { 104 | return el.id; 105 | }); 106 | 107 | for (i = 0; i < elements.length; i++) { 108 | if (this.hasAnchorJSLink(elements[i])) { 109 | indexesToDrop.push(i); 110 | continue; 111 | } 112 | 113 | if (elements[i].hasAttribute('id')) { 114 | elementID = elements[i].getAttribute('id'); 115 | } else { 116 | tidyText = this.urlify(elements[i].textContent); 117 | 118 | // Compare our generated ID to existing IDs (and increment it if needed) 119 | // before we add it to the page. 120 | newTidyText = tidyText; 121 | count = 0; 122 | do { 123 | if (index !== undefined) { 124 | newTidyText = tidyText + '-' + count; 125 | } 126 | 127 | index = idList.indexOf(newTidyText); 128 | count += 1; 129 | } while (index !== -1); 130 | index = undefined; 131 | idList.push(newTidyText); 132 | 133 | elements[i].setAttribute('id', newTidyText); 134 | elementID = newTidyText; 135 | } 136 | 137 | readableID = elementID.replace(/-/g, ' '); 138 | 139 | // The following code builds the following DOM structure in a more effiecient (albeit opaque) way. 140 | // ''; 141 | anchor = document.createElement('a'); 142 | anchor.className = 'anchorjs-link ' + this.options.class; 143 | anchor.href = '#' + elementID; 144 | anchor.setAttribute('aria-label', 'Anchor link for: ' + readableID); 145 | anchor.setAttribute('data-anchorjs-icon', this.options.icon); 146 | 147 | if (visibleOptionToUse === 'always') { 148 | anchor.style.opacity = '1'; 149 | } 150 | 151 | if (this.options.icon === '\ue9cb') { 152 | anchor.style.fontFamily = 'anchorjs-icons'; 153 | anchor.style.fontStyle = 'normal'; 154 | anchor.style.fontVariant = 'normal'; 155 | anchor.style.fontWeight = 'normal'; 156 | anchor.style.lineHeight = 1; 157 | 158 | // We set lineHeight = 1 here because the `anchorjs-icons` font family could otherwise affect the 159 | // height of the heading. This isn't the case for icons with `placement: left`, so we restore 160 | // line-height: inherit in that case, ensuring they remain positioned correctly. For more info, 161 | // see https://github.com/bryanbraun/anchorjs/issues/39. 162 | if (this.options.placement === 'left') { 163 | anchor.style.lineHeight = 'inherit'; 164 | } 165 | } 166 | 167 | if (this.options.placement === 'left') { 168 | anchor.style.position = 'absolute'; 169 | anchor.style.marginLeft = '-1em'; 170 | anchor.style.paddingRight = '0.5em'; 171 | elements[i].insertBefore(anchor, elements[i].firstChild); 172 | } else { // if the option provided is `right` (or anything else). 173 | anchor.style.paddingLeft = '0.375em'; 174 | elements[i].appendChild(anchor); 175 | } 176 | } 177 | 178 | for (i = 0; i < indexesToDrop.length; i++) { 179 | elements.splice(indexesToDrop[i] - i, 1); 180 | } 181 | this.elements = this.elements.concat(elements); 182 | 183 | return this; 184 | }; 185 | 186 | /** 187 | * Removes all anchorjs-links from elements targed by the selector. 188 | * @param {String|Array|Nodelist} selector - A CSS selector string targeting elements with anchor links, 189 | * OR a nodeList / array containing the DOM elements. 190 | * @return {this} - The AnchorJS object 191 | */ 192 | this.remove = function(selector) { 193 | var index, 194 | domAnchor, 195 | elements = _getElements(selector); 196 | 197 | for (var i = 0; i < elements.length; i++) { 198 | domAnchor = elements[i].querySelector('.anchorjs-link'); 199 | if (domAnchor) { 200 | // Drop the element from our main list, if it's in there. 201 | index = this.elements.indexOf(elements[i]); 202 | if (index !== -1) { 203 | this.elements.splice(index, 1); 204 | } 205 | // Remove the anchor from the DOM. 206 | elements[i].removeChild(domAnchor); 207 | } 208 | } 209 | return this; 210 | }; 211 | 212 | /** 213 | * Removes all anchorjs links. Mostly used for tests. 214 | */ 215 | this.removeAll = function() { 216 | this.remove(this.elements); 217 | }; 218 | 219 | /** 220 | * Urlify - Refine text so it makes a good ID. 221 | * 222 | * To do this, we remove apostrophes, replace nonsafe characters with hyphens, 223 | * remove extra hyphens, truncate, trim hyphens, and make lowercase. 224 | * 225 | * @param {String} text - Any text. Usually pulled from the webpage element we are linking to. 226 | * @return {String} - hyphen-delimited text for use in IDs and URLs. 227 | */ 228 | this.urlify = function(text) { 229 | // Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!']./()*\ 230 | var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'\]\.\/\(\)\*\\]/g, 231 | urlText; 232 | 233 | // The reason we include this _applyRemainingDefaultOptions is so urlify can be called independently, 234 | // even after setting options. This can be useful for tests or other applications. 235 | if (!this.options.truncate) { 236 | _applyRemainingDefaultOptions(this.options); 237 | } 238 | 239 | // Note: we trim hyphens after truncating because truncating can cause dangling hyphens. 240 | // Example string: // " ⚡⚡ Don't forget: URL fragments should be i18n-friendly, hyphenated, short, and clean." 241 | urlText = text.trim() // "⚡⚡ Don't forget: URL fragments should be i18n-friendly, hyphenated, short, and clean." 242 | .replace(/\'/gi, '') // "⚡⚡ Dont forget: URL fragments should be i18n-friendly, hyphenated, short, and clean." 243 | .replace(nonsafeChars, '-') // "⚡⚡-Dont-forget--URL-fragments-should-be-i18n-friendly--hyphenated--short--and-clean-" 244 | .replace(/-{2,}/g, '-') // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated-short-and-clean-" 245 | .substring(0, this.options.truncate) // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated-" 246 | .replace(/^-+|-+$/gm, '') // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated" 247 | .toLowerCase(); // "⚡⚡-dont-forget-url-fragments-should-be-i18n-friendly-hyphenated" 248 | 249 | return urlText; 250 | }; 251 | 252 | /** 253 | * Determines if this element already has an AnchorJS link on it. 254 | * Uses this technique: http://stackoverflow.com/a/5898748/1154642 255 | * @param {HTMLElemnt} el - a DOM node 256 | * @return {Boolean} true/false 257 | */ 258 | this.hasAnchorJSLink = function(el) { 259 | var hasLeftAnchor = el.firstChild && ((' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1), 260 | hasRightAnchor = el.lastChild && ((' ' + el.lastChild.className + ' ').indexOf(' anchorjs-link ') > -1); 261 | 262 | return hasLeftAnchor || hasRightAnchor || false; 263 | }; 264 | 265 | /** 266 | * Turns a selector, nodeList, or array of elements into an array of elements (so we can use array methods). 267 | * It also throws errors on any other inputs. Used to handle inputs to .add and .remove. 268 | * @param {String|Array|Nodelist} input - A CSS selector string targeting elements with anchor links, 269 | * OR a nodeList / array containing the DOM elements. 270 | * @return {Array} - An array containing the elements we want. 271 | */ 272 | function _getElements(input) { 273 | var elements; 274 | if (typeof input === 'string' || input instanceof String) { 275 | // See https://davidwalsh.name/nodelist-array for the technique transforming nodeList -> Array. 276 | elements = [].slice.call(document.querySelectorAll(input)); 277 | // I checked the 'input instanceof NodeList' test in IE9 and modern browsers and it worked for me. 278 | } else if (Array.isArray(input) || input instanceof NodeList) { 279 | elements = [].slice.call(input); 280 | } else { 281 | throw new Error('The selector provided to AnchorJS was invalid.'); 282 | } 283 | return elements; 284 | } 285 | 286 | /** 287 | * _addBaselineStyles 288 | * Adds baseline styles to the page, used by all AnchorJS links irregardless of configuration. 289 | */ 290 | function _addBaselineStyles() { 291 | // We don't want to add global baseline styles if they've been added before. 292 | if (document.head.querySelector('style.anchorjs') !== null) { 293 | return; 294 | } 295 | 296 | var style = document.createElement('style'), 297 | linkRule = 298 | ' .anchorjs-link {' + 299 | ' opacity: 0;' + 300 | ' text-decoration: none;' + 301 | ' -webkit-font-smoothing: antialiased;' + 302 | ' -moz-osx-font-smoothing: grayscale;' + 303 | ' }', 304 | hoverRule = 305 | ' *:hover > .anchorjs-link,' + 306 | ' .anchorjs-link:focus {' + 307 | ' opacity: 1;' + 308 | ' }', 309 | anchorjsLinkFontFace = 310 | ' @font-face {' + 311 | ' font-family: "anchorjs-icons";' + 312 | ' font-style: normal;' + 313 | ' font-weight: normal;' + // Icon from icomoon; 10px wide & 10px tall; 2 empty below & 4 above 314 | ' src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype");' + 315 | ' }', 316 | pseudoElContent = 317 | ' [data-anchorjs-icon]::after {' + 318 | ' content: attr(data-anchorjs-icon);' + 319 | ' }', 320 | firstStyleEl; 321 | 322 | style.className = 'anchorjs'; 323 | style.appendChild(document.createTextNode('')); // Necessary for Webkit. 324 | 325 | // We place it in the head with the other style tags, if possible, so as to 326 | // not look out of place. We insert before the others so these styles can be 327 | // overridden if necessary. 328 | firstStyleEl = document.head.querySelector('[rel="stylesheet"], style'); 329 | if (firstStyleEl === undefined) { 330 | document.head.appendChild(style); 331 | } else { 332 | document.head.insertBefore(style, firstStyleEl); 333 | } 334 | 335 | style.sheet.insertRule(linkRule, style.sheet.cssRules.length); 336 | style.sheet.insertRule(hoverRule, style.sheet.cssRules.length); 337 | style.sheet.insertRule(pseudoElContent, style.sheet.cssRules.length); 338 | style.sheet.insertRule(anchorjsLinkFontFace, style.sheet.cssRules.length); 339 | } 340 | } 341 | 342 | return AnchorJS; 343 | })); 344 | -------------------------------------------------------------------------------- /assets/anchor.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * AnchorJS - v3.2.0 - 2016-06-10 3 | * https://github.com/bryanbraun/anchorjs 4 | * Copyright (c) 2016 Bryan Braun; Licensed MIT 5 | */ 6 | "use strict";!function(A,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){function A(A){function e(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.class=A.hasOwnProperty("class")?A.class:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64}function t(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}function n(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style"),t=" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",n=" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",o=' @font-face { font-family: "anchorjs-icons"; font-style: normal; font-weight: normal; src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype"); }',i=" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }";e.className="anchorjs",e.appendChild(document.createTextNode("")),A=document.head.querySelector('[rel="stylesheet"], style'),void 0===A?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(t,e.sheet.cssRules.length),e.sheet.insertRule(n,e.sheet.cssRules.length),e.sheet.insertRule(i,e.sheet.cssRules.length),e.sheet.insertRule(o,e.sheet.cssRules.length)}}this.options=A||{},this.elements=[],e(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var o,i,s,a,r,c,l,h,u,g,B,f,d=[];if(e(this.options),f=this.options.visible,"touch"===f&&(f=this.isTouchDevice()?"always":"hover"),A||(A="h1, h2, h3, h4, h5, h6"),o=t(A),0===o.length)return!1;for(n(),i=document.querySelectorAll("[id]"),s=[].map.call(i,function(A){return A.id}),r=0;r-1,t=A.lastChild&&(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ")>-1;return e||t||!1}}return A}); 7 | -------------------------------------------------------------------------------- /assets/examples.js: -------------------------------------------------------------------------------- 1 | examples.lang = { 2 | color: function (pre, value) { 3 | var colors = pre.parentNode.insertBefore(document.createElement('div'), pre); 4 | var lines = value.trim().split(/\n+/); 5 | 6 | colors.className = 'colors'; 7 | 8 | lines.map(parseLine).map(parseColor).forEach(colors.appendChild, colors); 9 | 10 | function parseLine(line) { 11 | line = line.trim(); 12 | 13 | var color = {}; 14 | var match = /@([^:]+):\s*(.+?)(?=\s+@|$)/g; 15 | var prop; 16 | 17 | while (prop = match.exec(line)) color[prop[1]] = prop[2]; 18 | 19 | return color; 20 | } 21 | 22 | function parseColor(color) { 23 | var colorNode = document.createElement('div'); 24 | 25 | colorNode.className = 'swatch'; 26 | 27 | colorNode.style.backgroundColor = color.color; 28 | 29 | var contrastColor = contrast(color.color); 30 | 31 | colorNode.style.color = contrastColor; 32 | 33 | colorNode.style.textShadow = '0 0 1px ' + (contrastColor === '#ffffff' ? '#000000' : '#ffffff'); 34 | 35 | colorNode.appendChild(document.createTextNode(color.color)); 36 | 37 | Object.keys(color).filter(function (key) { return key !== 'color' }).forEach(function (key) { 38 | var propertyNode = colorNode.appendChild(document.createElement('div')); 39 | 40 | propertyNode.className = 'color-property'; 41 | 42 | propertyNode.setAttribute('data-name', key); 43 | 44 | propertyNode.appendChild(document.createTextNode(color[key])); 45 | }); 46 | 47 | return colorNode; 48 | } 49 | 50 | function hex2rgb(hex) { 51 | var bigint = parseInt(hex.slice(1).replace(/^([0-9a-f])([0-9a-f])([0-9a-f])$/i, '$1$1$2$2$3$3'), 16); 52 | var r = (bigint >> 16) & 255; 53 | var g = (bigint >> 8) & 255; 54 | var b = bigint & 255; 55 | 56 | return [r, g, b]; 57 | } 58 | 59 | function getRGB(color) { 60 | return /^#/.test(color) ? hex2rgb(color) : color.replace(/[^\d,]+/g, '').split(/,/).map(function (part) { return part * 1; }); 61 | } 62 | 63 | function contrast(color) { 64 | var rgb = getRGB(color); 65 | var o = Math.round(((parseInt(rgb[0]) * 299) + (parseInt(rgb[1]) * 587) + (parseInt(rgb[2]) * 114)) / 1000); 66 | 67 | return o <= 180 ? '#ffffff' : '#000000'; 68 | } 69 | }, 70 | html: function (pre, value, conf) { 71 | // get wrap 72 | var wrap = pre.parentNode; 73 | pre.className = 'highlight'; 74 | 75 | var preview = wrap.insertBefore(document.createElement('div'), pre); 76 | preview.className = 'docs-example clearfix'; 77 | 78 | var resizeDiv = preview.appendChild(document.createElement('div')); 79 | resizeDiv.className = 'docs-resize'; 80 | 81 | var resizeLeft = resizeDiv.appendChild(document.createElement('span')); 82 | resizeLeft.className = 'c-resize--left'; 83 | 84 | var iframe = resizeDiv.appendChild(document.createElement('iframe')); 85 | iframe.className = 'docs-iframe'; 86 | var style = iframe.style; 87 | 88 | var resizeRight = resizeDiv.appendChild(document.createElement('span')); 89 | resizeRight.className = 'c-resize--right'; 90 | 91 | // get iframe dom 92 | var iwin = iframe.contentWindow; 93 | var idoc = iwin.document; 94 | 95 | // write example content to iframe 96 | idoc.open(); 97 | 98 | var html = ''; 103 | 104 | html += examples.css.map(function (css) { 105 | return ''; 106 | }).join(''); 107 | 108 | html += examples.js.map(function (js) { 109 | return ''; 110 | }).join(''); 111 | 112 | html += value; 113 | 114 | html += examples.bodyjs.map(function (js) { 115 | return ''; 116 | }).join(''); 117 | 118 | idoc.write(html); 119 | 120 | idoc.close(); 121 | 122 | // add default block styles to iframe dom 123 | iwin.addEventListener('load', function(){ 124 | idoc.documentElement.setAttribute('style', examples.htmlcss); 125 | idoc.body.setAttribute('style', examples.bodycss); 126 | iframe.setAttribute('class', 'docs-iframe clearfix'); 127 | }); 128 | 129 | if (conf.width) style.width = String(conf.width); 130 | 131 | // set iframe height based on content 132 | var documentElement = idoc.documentElement; 133 | var scrollHeight; 134 | 135 | function resizeIFrame() { 136 | var currentScrollHeight = documentElement.scrollHeight; 137 | 138 | if (scrollHeight !== currentScrollHeight) { 139 | scrollHeight = currentScrollHeight; 140 | 141 | style.height = 0; 142 | 143 | style.height = documentElement.scrollHeight + (iframe.offsetHeight - iwin.innerHeight) + 'px'; 144 | } 145 | } 146 | 147 | iwin.addEventListener('load', function () { 148 | resizeIFrame(); 149 | }); 150 | } 151 | }; 152 | -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/assets/logo.png -------------------------------------------------------------------------------- /assets/mdcss-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/assets/mdcss-logo.png -------------------------------------------------------------------------------- /assets/octicons/octicons-local.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/assets/octicons/octicons-local.ttf -------------------------------------------------------------------------------- /assets/octicons/octicons.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'octicons'; 3 | src: url('octicons.eot?#iefix') format('embedded-opentype'), 4 | url('octicons.woff') format('woff'), 5 | url('octicons.ttf') format('truetype'), 6 | url('octicons.svg#octicons') format('svg'); 7 | font-weight: normal; 8 | font-style: normal; 9 | } 10 | 11 | /* 12 | 13 | .octicon is optimized for 16px. 14 | .mega-octicon is optimized for 32px but can be used larger. 15 | 16 | */ 17 | .octicon, .mega-octicon { 18 | font: normal normal normal 16px/1 octicons; 19 | display: inline-block; 20 | text-decoration: none; 21 | text-rendering: auto; 22 | -webkit-font-smoothing: antialiased; 23 | -moz-osx-font-smoothing: grayscale; 24 | -webkit-user-select: none; 25 | -moz-user-select: none; 26 | -ms-user-select: none; 27 | user-select: none; 28 | } 29 | .mega-octicon { font-size: 32px; } 30 | 31 | .octicon-alert:before { content: '\f02d'} /*  */ 32 | .octicon-arrow-down:before { content: '\f03f'} /*  */ 33 | .octicon-arrow-left:before { content: '\f040'} /*  */ 34 | .octicon-arrow-right:before { content: '\f03e'} /*  */ 35 | .octicon-arrow-small-down:before { content: '\f0a0'} /*  */ 36 | .octicon-arrow-small-left:before { content: '\f0a1'} /*  */ 37 | .octicon-arrow-small-right:before { content: '\f071'} /*  */ 38 | .octicon-arrow-small-up:before { content: '\f09f'} /*  */ 39 | .octicon-arrow-up:before { content: '\f03d'} /*  */ 40 | .octicon-microscope:before, 41 | .octicon-beaker:before { content: '\f0dd'} /*  */ 42 | .octicon-bell:before { content: '\f0de'} /*  */ 43 | .octicon-bold:before { content: '\f0e2'} /*  */ 44 | .octicon-book:before { content: '\f007'} /*  */ 45 | .octicon-bookmark:before { content: '\f07b'} /*  */ 46 | .octicon-briefcase:before { content: '\f0d3'} /*  */ 47 | .octicon-broadcast:before { content: '\f048'} /*  */ 48 | .octicon-browser:before { content: '\f0c5'} /*  */ 49 | .octicon-bug:before { content: '\f091'} /*  */ 50 | .octicon-calendar:before { content: '\f068'} /*  */ 51 | .octicon-check:before { content: '\f03a'} /*  */ 52 | .octicon-checklist:before { content: '\f076'} /*  */ 53 | .octicon-chevron-down:before { content: '\f0a3'} /*  */ 54 | .octicon-chevron-left:before { content: '\f0a4'} /*  */ 55 | .octicon-chevron-right:before { content: '\f078'} /*  */ 56 | .octicon-chevron-up:before { content: '\f0a2'} /*  */ 57 | .octicon-circle-slash:before { content: '\f084'} /*  */ 58 | .octicon-circuit-board:before { content: '\f0d6'} /*  */ 59 | .octicon-clippy:before { content: '\f035'} /*  */ 60 | .octicon-clock:before { content: '\f046'} /*  */ 61 | .octicon-cloud-download:before { content: '\f00b'} /*  */ 62 | .octicon-cloud-upload:before { content: '\f00c'} /*  */ 63 | .octicon-code:before { content: '\f05f'} /*  */ 64 | .octicon-comment-add:before, 65 | .octicon-comment:before { content: '\f02b'} /*  */ 66 | .octicon-comment-discussion:before { content: '\f04f'} /*  */ 67 | .octicon-credit-card:before { content: '\f045'} /*  */ 68 | .octicon-dash:before { content: '\f0ca'} /*  */ 69 | .octicon-dashboard:before { content: '\f07d'} /*  */ 70 | .octicon-database:before { content: '\f096'} /*  */ 71 | .octicon-clone:before, 72 | .octicon-desktop-download:before { content: '\f0dc'} /*  */ 73 | .octicon-device-camera:before { content: '\f056'} /*  */ 74 | .octicon-device-camera-video:before { content: '\f057'} /*  */ 75 | .octicon-device-desktop:before { content: '\f27c'} /*  */ 76 | .octicon-device-mobile:before { content: '\f038'} /*  */ 77 | .octicon-diff:before { content: '\f04d'} /*  */ 78 | .octicon-diff-added:before { content: '\f06b'} /*  */ 79 | .octicon-diff-ignored:before { content: '\f099'} /*  */ 80 | .octicon-diff-modified:before { content: '\f06d'} /*  */ 81 | .octicon-diff-removed:before { content: '\f06c'} /*  */ 82 | .octicon-diff-renamed:before { content: '\f06e'} /*  */ 83 | .octicon-ellipsis:before { content: '\f09a'} /*  */ 84 | .octicon-eye-unwatch:before, 85 | .octicon-eye-watch:before, 86 | .octicon-eye:before { content: '\f04e'} /*  */ 87 | .octicon-file-binary:before { content: '\f094'} /*  */ 88 | .octicon-file-code:before { content: '\f010'} /*  */ 89 | .octicon-file-directory:before { content: '\f016'} /*  */ 90 | .octicon-file-media:before { content: '\f012'} /*  */ 91 | .octicon-file-pdf:before { content: '\f014'} /*  */ 92 | .octicon-file-submodule:before { content: '\f017'} /*  */ 93 | .octicon-file-symlink-directory:before { content: '\f0b1'} /*  */ 94 | .octicon-file-symlink-file:before { content: '\f0b0'} /*  */ 95 | .octicon-file-text:before { content: '\f011'} /*  */ 96 | .octicon-file-zip:before { content: '\f013'} /*  */ 97 | .octicon-flame:before { content: '\f0d2'} /*  */ 98 | .octicon-fold:before { content: '\f0cc'} /*  */ 99 | .octicon-gear:before { content: '\f02f'} /*  */ 100 | .octicon-gift:before { content: '\f042'} /*  */ 101 | .octicon-gist:before { content: '\f00e'} /*  */ 102 | .octicon-gist-secret:before { content: '\f08c'} /*  */ 103 | .octicon-git-branch-create:before, 104 | .octicon-git-branch-delete:before, 105 | .octicon-git-branch:before { content: '\f020'} /*  */ 106 | .octicon-git-commit:before { content: '\f01f'} /*  */ 107 | .octicon-git-compare:before { content: '\f0ac'} /*  */ 108 | .octicon-git-merge:before { content: '\f023'} /*  */ 109 | .octicon-git-pull-request-abandoned:before, 110 | .octicon-git-pull-request:before { content: '\f009'} /*  */ 111 | .octicon-globe:before { content: '\f0b6'} /*  */ 112 | .octicon-graph:before { content: '\f043'} /*  */ 113 | .octicon-heart:before { content: '\2665'} /* ♥ */ 114 | .octicon-history:before { content: '\f07e'} /*  */ 115 | .octicon-home:before { content: '\f08d'} /*  */ 116 | .octicon-horizontal-rule:before { content: '\f070'} /*  */ 117 | .octicon-hubot:before { content: '\f09d'} /*  */ 118 | .octicon-inbox:before { content: '\f0cf'} /*  */ 119 | .octicon-info:before { content: '\f059'} /*  */ 120 | .octicon-issue-closed:before { content: '\f028'} /*  */ 121 | .octicon-issue-opened:before { content: '\f026'} /*  */ 122 | .octicon-issue-reopened:before { content: '\f027'} /*  */ 123 | .octicon-italic:before { content: '\f0e4'} /*  */ 124 | .octicon-jersey:before { content: '\f019'} /*  */ 125 | .octicon-key:before { content: '\f049'} /*  */ 126 | .octicon-keyboard:before { content: '\f00d'} /*  */ 127 | .octicon-law:before { content: '\f0d8'} /*  */ 128 | .octicon-light-bulb:before { content: '\f000'} /*  */ 129 | .octicon-link:before { content: '\f05c'} /*  */ 130 | .octicon-link-external:before { content: '\f07f'} /*  */ 131 | .octicon-list-ordered:before { content: '\f062'} /*  */ 132 | .octicon-list-unordered:before { content: '\f061'} /*  */ 133 | .octicon-location:before { content: '\f060'} /*  */ 134 | .octicon-gist-private:before, 135 | .octicon-mirror-private:before, 136 | .octicon-git-fork-private:before, 137 | .octicon-lock:before { content: '\f06a'} /*  */ 138 | .octicon-logo-gist:before { content: '\f0ad'} /*  */ 139 | .octicon-logo-github:before { content: '\f092'} /*  */ 140 | .octicon-mail:before { content: '\f03b'} /*  */ 141 | .octicon-mail-read:before { content: '\f03c'} /*  */ 142 | .octicon-mail-reply:before { content: '\f051'} /*  */ 143 | .octicon-mark-github:before { content: '\f00a'} /*  */ 144 | .octicon-markdown:before { content: '\f0c9'} /*  */ 145 | .octicon-megaphone:before { content: '\f077'} /*  */ 146 | .octicon-mention:before { content: '\f0be'} /*  */ 147 | .octicon-milestone:before { content: '\f075'} /*  */ 148 | .octicon-mirror-public:before, 149 | .octicon-mirror:before { content: '\f024'} /*  */ 150 | .octicon-mortar-board:before { content: '\f0d7'} /*  */ 151 | .octicon-mute:before { content: '\f080'} /*  */ 152 | .octicon-no-newline:before { content: '\f09c'} /*  */ 153 | .octicon-octoface:before { content: '\f008'} /*  */ 154 | .octicon-organization:before { content: '\f037'} /*  */ 155 | .octicon-package:before { content: '\f0c4'} /*  */ 156 | .octicon-paintcan:before { content: '\f0d1'} /*  */ 157 | .octicon-pencil:before { content: '\f058'} /*  */ 158 | .octicon-person-add:before, 159 | .octicon-person-follow:before, 160 | .octicon-person:before { content: '\f018'} /*  */ 161 | .octicon-pin:before { content: '\f041'} /*  */ 162 | .octicon-plug:before { content: '\f0d4'} /*  */ 163 | .octicon-repo-create:before, 164 | .octicon-gist-new:before, 165 | .octicon-file-directory-create:before, 166 | .octicon-file-add:before, 167 | .octicon-plus:before { content: '\f05d'} /*  */ 168 | .octicon-primitive-dot:before { content: '\f052'} /*  */ 169 | .octicon-primitive-square:before { content: '\f053'} /*  */ 170 | .octicon-pulse:before { content: '\f085'} /*  */ 171 | .octicon-question:before { content: '\f02c'} /*  */ 172 | .octicon-quote:before { content: '\f063'} /*  */ 173 | .octicon-radio-tower:before { content: '\f030'} /*  */ 174 | .octicon-repo-delete:before, 175 | .octicon-repo:before { content: '\f001'} /*  */ 176 | .octicon-repo-clone:before { content: '\f04c'} /*  */ 177 | .octicon-repo-force-push:before { content: '\f04a'} /*  */ 178 | .octicon-gist-fork:before, 179 | .octicon-repo-forked:before { content: '\f002'} /*  */ 180 | .octicon-repo-pull:before { content: '\f006'} /*  */ 181 | .octicon-repo-push:before { content: '\f005'} /*  */ 182 | .octicon-rocket:before { content: '\f033'} /*  */ 183 | .octicon-rss:before { content: '\f034'} /*  */ 184 | .octicon-ruby:before { content: '\f047'} /*  */ 185 | .octicon-search-save:before, 186 | .octicon-search:before { content: '\f02e'} /*  */ 187 | .octicon-server:before { content: '\f097'} /*  */ 188 | .octicon-settings:before { content: '\f07c'} /*  */ 189 | .octicon-shield:before { content: '\f0e1'} /*  */ 190 | .octicon-log-in:before, 191 | .octicon-sign-in:before { content: '\f036'} /*  */ 192 | .octicon-log-out:before, 193 | .octicon-sign-out:before { content: '\f032'} /*  */ 194 | .octicon-smiley:before { content: '\f0e7'} /*  */ 195 | .octicon-squirrel:before { content: '\f0b2'} /*  */ 196 | .octicon-star-add:before, 197 | .octicon-star-delete:before, 198 | .octicon-star:before { content: '\f02a'} /*  */ 199 | .octicon-stop:before { content: '\f08f'} /*  */ 200 | .octicon-repo-sync:before, 201 | .octicon-sync:before { content: '\f087'} /*  */ 202 | .octicon-tag-remove:before, 203 | .octicon-tag-add:before, 204 | .octicon-tag:before { content: '\f015'} /*  */ 205 | .octicon-tasklist:before { content: '\f0e5'} /*  */ 206 | .octicon-telescope:before { content: '\f088'} /*  */ 207 | .octicon-terminal:before { content: '\f0c8'} /*  */ 208 | .octicon-text-size:before { content: '\f0e3'} /*  */ 209 | .octicon-three-bars:before { content: '\f05e'} /*  */ 210 | .octicon-thumbsdown:before { content: '\f0db'} /*  */ 211 | .octicon-thumbsup:before { content: '\f0da'} /*  */ 212 | .octicon-tools:before { content: '\f031'} /*  */ 213 | .octicon-trashcan:before { content: '\f0d0'} /*  */ 214 | .octicon-triangle-down:before { content: '\f05b'} /*  */ 215 | .octicon-triangle-left:before { content: '\f044'} /*  */ 216 | .octicon-triangle-right:before { content: '\f05a'} /*  */ 217 | .octicon-triangle-up:before { content: '\f0aa'} /*  */ 218 | .octicon-unfold:before { content: '\f039'} /*  */ 219 | .octicon-unmute:before { content: '\f0ba'} /*  */ 220 | .octicon-unverified:before { content: '\f0e8'} /*  */ 221 | .octicon-verified:before { content: '\f0e6'} /*  */ 222 | .octicon-versions:before { content: '\f064'} /*  */ 223 | .octicon-watch:before { content: '\f0e0'} /*  */ 224 | .octicon-remove-close:before, 225 | .octicon-x:before { content: '\f081'} /*  */ 226 | .octicon-zap:before { content: '\26A1'} /* ⚡ */ 227 | -------------------------------------------------------------------------------- /assets/octicons/octicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/assets/octicons/octicons.eot -------------------------------------------------------------------------------- /assets/octicons/octicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/assets/octicons/octicons.ttf -------------------------------------------------------------------------------- /assets/octicons/octicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/assets/octicons/octicons.woff -------------------------------------------------------------------------------- /assets/prism.js: -------------------------------------------------------------------------------- 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+markdown+php+scss+wiki */ 2 | var _self = (typeof window !== 'undefined') 3 | ? window // if in browser 4 | : ( 5 | (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) 6 | ? self // if in worker 7 | : {} // if in node js 8 | ); 9 | 10 | /** 11 | * Prism: Lightweight, robust, elegant syntax highlighting 12 | * MIT license http://www.opensource.org/licenses/mit-license.php/ 13 | * @author Lea Verou http://lea.verou.me 14 | */ 15 | 16 | var Prism = (function(){ 17 | 18 | // Private helper vars 19 | var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; 20 | 21 | var _ = _self.Prism = { 22 | util: { 23 | encode: function (tokens) { 24 | if (tokens instanceof Token) { 25 | return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); 26 | } else if (_.util.type(tokens) === 'Array') { 27 | return tokens.map(_.util.encode); 28 | } else { 29 | return tokens.replace(/&/g, '&').replace(/ text.length) { 270 | // Something went terribly wrong, ABORT, ABORT! 271 | break tokenloop; 272 | } 273 | 274 | if (str instanceof Token) { 275 | continue; 276 | } 277 | 278 | pattern.lastIndex = 0; 279 | 280 | var match = pattern.exec(str); 281 | 282 | if (match) { 283 | if(lookbehind) { 284 | lookbehindLength = match[1].length; 285 | } 286 | 287 | var from = match.index - 1 + lookbehindLength, 288 | match = match[0].slice(lookbehindLength), 289 | len = match.length, 290 | to = from + len, 291 | before = str.slice(0, from + 1), 292 | after = str.slice(to + 1); 293 | 294 | var args = [i, 1]; 295 | 296 | if (before) { 297 | args.push(before); 298 | } 299 | 300 | var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias); 301 | 302 | args.push(wrapped); 303 | 304 | if (after) { 305 | args.push(after); 306 | } 307 | 308 | Array.prototype.splice.apply(strarr, args); 309 | } 310 | } 311 | } 312 | } 313 | 314 | return strarr; 315 | }, 316 | 317 | hooks: { 318 | all: {}, 319 | 320 | add: function (name, callback) { 321 | var hooks = _.hooks.all; 322 | 323 | hooks[name] = hooks[name] || []; 324 | 325 | hooks[name].push(callback); 326 | }, 327 | 328 | run: function (name, env) { 329 | var callbacks = _.hooks.all[name]; 330 | 331 | if (!callbacks || !callbacks.length) { 332 | return; 333 | } 334 | 335 | for (var i=0, callback; callback = callbacks[i++];) { 336 | callback(env); 337 | } 338 | } 339 | } 340 | }; 341 | 342 | var Token = _.Token = function(type, content, alias) { 343 | this.type = type; 344 | this.content = content; 345 | this.alias = alias; 346 | }; 347 | 348 | Token.stringify = function(o, language, parent) { 349 | if (typeof o == 'string') { 350 | return o; 351 | } 352 | 353 | if (_.util.type(o) === 'Array') { 354 | return o.map(function(element) { 355 | return Token.stringify(element, language, o); 356 | }).join(''); 357 | } 358 | 359 | var env = { 360 | type: o.type, 361 | content: Token.stringify(o.content, language, parent), 362 | tag: 'span', 363 | classes: ['token', o.type], 364 | attributes: {}, 365 | language: language, 366 | parent: parent 367 | }; 368 | 369 | if (env.type == 'comment') { 370 | env.attributes['spellcheck'] = 'true'; 371 | } 372 | 373 | if (o.alias) { 374 | var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; 375 | Array.prototype.push.apply(env.classes, aliases); 376 | } 377 | 378 | _.hooks.run('wrap', env); 379 | 380 | var attributes = ''; 381 | 382 | for (var name in env.attributes) { 383 | attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"'; 384 | } 385 | 386 | return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; 387 | 388 | }; 389 | 390 | if (!_self.document) { 391 | if (!_self.addEventListener) { 392 | // in Node.js 393 | return _self.Prism; 394 | } 395 | // In worker 396 | _self.addEventListener('message', function(evt) { 397 | var message = JSON.parse(evt.data), 398 | lang = message.language, 399 | code = message.code, 400 | immediateClose = message.immediateClose; 401 | 402 | _self.postMessage(_.highlight(code, _.languages[lang], lang)); 403 | if (immediateClose) { 404 | _self.close(); 405 | } 406 | }, false); 407 | 408 | return _self.Prism; 409 | } 410 | 411 | return _self.Prism; 412 | 413 | })(); 414 | 415 | if (typeof module !== 'undefined' && module.exports) { 416 | module.exports = Prism; 417 | } 418 | 419 | // hack for components to work correctly in node.js 420 | if (typeof global !== 'undefined') { 421 | global.Prism = Prism; 422 | } 423 | ; 424 | Prism.languages.markup = { 425 | 'comment': //, 426 | 'prolog': /<\?[\w\W]+?\?>/, 427 | 'doctype': //, 428 | 'cdata': //i, 429 | 'tag': { 430 | pattern: /<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i, 431 | inside: { 432 | 'tag': { 433 | pattern: /^<\/?[^\s>\/]+/i, 434 | inside: { 435 | 'punctuation': /^<\/?/, 436 | 'namespace': /^[^\s>\/:]+:/ 437 | } 438 | }, 439 | 'attr-value': { 440 | pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, 441 | inside: { 442 | 'punctuation': /[=>"']/ 443 | } 444 | }, 445 | 'punctuation': /\/?>/, 446 | 'attr-name': { 447 | pattern: /[^\s>\/]+/, 448 | inside: { 449 | 'namespace': /^[^\s>\/:]+:/ 450 | } 451 | } 452 | 453 | } 454 | }, 455 | 'entity': /&#?[\da-z]{1,8};/i 456 | }; 457 | 458 | // Plugin to make entity title show the real entity, idea by Roman Komarov 459 | Prism.hooks.add('wrap', function(env) { 460 | 461 | if (env.type === 'entity') { 462 | env.attributes['title'] = env.content.replace(/&/, '&'); 463 | } 464 | }); 465 | 466 | Prism.languages.xml = Prism.languages.markup; 467 | Prism.languages.html = Prism.languages.markup; 468 | Prism.languages.mathml = Prism.languages.markup; 469 | Prism.languages.svg = Prism.languages.markup; 470 | 471 | Prism.languages.css = { 472 | 'comment': /\/\*[\w\W]*?\*\//, 473 | 'atrule': { 474 | pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, 475 | inside: { 476 | 'rule': /@[\w-]+/ 477 | // See rest below 478 | } 479 | }, 480 | 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, 481 | 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/, 482 | 'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/, 483 | 'property': /(\b|\B)[\w-]+(?=\s*:)/i, 484 | 'important': /\B!important\b/i, 485 | 'function': /[-a-z0-9]+(?=\()/i, 486 | 'punctuation': /[(){};:]/ 487 | }; 488 | 489 | Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css); 490 | 491 | if (Prism.languages.markup) { 492 | Prism.languages.insertBefore('markup', 'tag', { 493 | 'style': { 494 | pattern: /()[\w\W]*?(?=<\/style>)/i, 495 | lookbehind: true, 496 | inside: Prism.languages.css, 497 | alias: 'language-css' 498 | } 499 | }); 500 | 501 | Prism.languages.insertBefore('inside', 'attr-value', { 502 | 'style-attr': { 503 | pattern: /\s*style=("|').*?\1/i, 504 | inside: { 505 | 'attr-name': { 506 | pattern: /^\s*style/i, 507 | inside: Prism.languages.markup.tag.inside 508 | }, 509 | 'punctuation': /^\s*=\s*['"]|['"]\s*$/, 510 | 'attr-value': { 511 | pattern: /.+/i, 512 | inside: Prism.languages.css 513 | } 514 | }, 515 | alias: 'language-css' 516 | } 517 | }, Prism.languages.markup.tag); 518 | }; 519 | Prism.languages.clike = { 520 | 'comment': [ 521 | { 522 | pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, 523 | lookbehind: true 524 | }, 525 | { 526 | pattern: /(^|[^\\:])\/\/.*/, 527 | lookbehind: true 528 | } 529 | ], 530 | 'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, 531 | 'class-name': { 532 | pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i, 533 | lookbehind: true, 534 | inside: { 535 | punctuation: /(\.|\\)/ 536 | } 537 | }, 538 | 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, 539 | 'boolean': /\b(true|false)\b/, 540 | 'function': /[a-z0-9_]+(?=\()/i, 541 | 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i, 542 | 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, 543 | 'punctuation': /[{}[\];(),.:]/ 544 | }; 545 | 546 | Prism.languages.javascript = Prism.languages.extend('clike', { 547 | 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, 548 | 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/, 549 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) 550 | 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i 551 | }); 552 | 553 | Prism.languages.insertBefore('javascript', 'keyword', { 554 | 'regex': { 555 | pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, 556 | lookbehind: true 557 | } 558 | }); 559 | 560 | Prism.languages.insertBefore('javascript', 'class-name', { 561 | 'template-string': { 562 | pattern: /`(?:\\`|\\?[^`])*`/, 563 | inside: { 564 | 'interpolation': { 565 | pattern: /\$\{[^}]+\}/, 566 | inside: { 567 | 'interpolation-punctuation': { 568 | pattern: /^\$\{|\}$/, 569 | alias: 'punctuation' 570 | }, 571 | rest: Prism.languages.javascript 572 | } 573 | }, 574 | 'string': /[\s\S]+/ 575 | } 576 | } 577 | }); 578 | 579 | if (Prism.languages.markup) { 580 | Prism.languages.insertBefore('markup', 'tag', { 581 | 'script': { 582 | pattern: /()[\w\W]*?(?=<\/script>)/i, 583 | lookbehind: true, 584 | inside: Prism.languages.javascript, 585 | alias: 'language-javascript' 586 | } 587 | }); 588 | } 589 | 590 | Prism.languages.js = Prism.languages.javascript; 591 | (function(Prism) { 592 | var insideString = { 593 | variable: [ 594 | // Arithmetic Environment 595 | { 596 | pattern: /\$?\(\([\w\W]+?\)\)/, 597 | inside: { 598 | // If there is a $ sign at the beginning highlight $(( and )) as variable 599 | variable: [{ 600 | pattern: /(^\$\(\([\w\W]+)\)\)/, 601 | lookbehind: true 602 | }, 603 | /^\$\(\(/, 604 | ], 605 | number: /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/, 606 | // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic 607 | operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/, 608 | // If there is no $ sign at the beginning highlight (( and )) as punctuation 609 | punctuation: /\(\(?|\)\)?|,|;/ 610 | } 611 | }, 612 | // Command Substitution 613 | { 614 | pattern: /\$\([^)]+\)|`[^`]+`/, 615 | inside: { 616 | variable: /^\$\(|^`|\)$|`$/ 617 | } 618 | }, 619 | /\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i 620 | ], 621 | }; 622 | 623 | Prism.languages.bash = { 624 | 'shebang': { 625 | pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/, 626 | alias: 'important' 627 | }, 628 | 'comment': { 629 | pattern: /(^|[^"{\\])#.*/, 630 | lookbehind: true 631 | }, 632 | 'string': [ 633 | //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document 634 | { 635 | pattern: /((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g, 636 | lookbehind: true, 637 | inside: insideString 638 | }, 639 | { 640 | pattern: /("|')(?:\\?[\s\S])*?\1/g, 641 | inside: insideString 642 | } 643 | ], 644 | 'variable': insideString.variable, 645 | // Originally based on http://ss64.com/bash/ 646 | 'function': { 647 | pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/, 648 | lookbehind: true 649 | }, 650 | 'keyword': { 651 | pattern: /(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/, 652 | lookbehind: true 653 | }, 654 | 'boolean': { 655 | pattern: /(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/, 656 | lookbehind: true 657 | }, 658 | 'operator': /&&?|\|\|?|==?|!=?|<<>|<=?|>=?|=~/, 659 | 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/ 660 | }; 661 | 662 | var inside = insideString.variable[1].inside; 663 | inside['function'] = Prism.languages.bash['function']; 664 | inside.keyword = Prism.languages.bash.keyword; 665 | inside.boolean = Prism.languages.bash.boolean; 666 | inside.operator = Prism.languages.bash.operator; 667 | inside.punctuation = Prism.languages.bash.punctuation; 668 | })(Prism); 669 | Prism.languages.markdown = Prism.languages.extend('markup', {}); 670 | Prism.languages.insertBefore('markdown', 'prolog', { 671 | 'blockquote': { 672 | // > ... 673 | pattern: /^>(?:[\t ]*>)*/m, 674 | alias: 'punctuation' 675 | }, 676 | 'code': [ 677 | { 678 | // Prefixed by 4 spaces or 1 tab 679 | pattern: /^(?: {4}|\t).+/m, 680 | alias: 'keyword' 681 | }, 682 | { 683 | // `code` 684 | // ``code`` 685 | pattern: /``.+?``|`[^`\n]+`/, 686 | alias: 'keyword' 687 | } 688 | ], 689 | 'title': [ 690 | { 691 | // title 1 692 | // ======= 693 | 694 | // title 2 695 | // ------- 696 | pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/, 697 | alias: 'important', 698 | inside: { 699 | punctuation: /==+$|--+$/ 700 | } 701 | }, 702 | { 703 | // # title 1 704 | // ###### title 6 705 | pattern: /(^\s*)#+.+/m, 706 | lookbehind: true, 707 | alias: 'important', 708 | inside: { 709 | punctuation: /^#+|#+$/ 710 | } 711 | } 712 | ], 713 | 'hr': { 714 | // *** 715 | // --- 716 | // * * * 717 | // ----------- 718 | pattern: /(^\s*)([*-])([\t ]*\2){2,}(?=\s*$)/m, 719 | lookbehind: true, 720 | alias: 'punctuation' 721 | }, 722 | 'list': { 723 | // * item 724 | // + item 725 | // - item 726 | // 1. item 727 | pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m, 728 | lookbehind: true, 729 | alias: 'punctuation' 730 | }, 731 | 'url-reference': { 732 | // [id]: http://example.com "Optional title" 733 | // [id]: http://example.com 'Optional title' 734 | // [id]: http://example.com (Optional title) 735 | // [id]: "Optional title" 736 | pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/, 737 | inside: { 738 | 'variable': { 739 | pattern: /^(!?\[)[^\]]+/, 740 | lookbehind: true 741 | }, 742 | 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/, 743 | 'punctuation': /^[\[\]!:]|[<>]/ 744 | }, 745 | alias: 'url' 746 | }, 747 | 'bold': { 748 | // **strong** 749 | // __strong__ 750 | 751 | // Allow only one line break 752 | pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/, 753 | lookbehind: true, 754 | inside: { 755 | 'punctuation': /^\*\*|^__|\*\*$|__$/ 756 | } 757 | }, 758 | 'italic': { 759 | // *em* 760 | // _em_ 761 | 762 | // Allow only one line break 763 | pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/, 764 | lookbehind: true, 765 | inside: { 766 | 'punctuation': /^[*_]|[*_]$/ 767 | } 768 | }, 769 | 'url': { 770 | // [example](http://example.com "Optional title") 771 | // [example] [id] 772 | pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/, 773 | inside: { 774 | 'variable': { 775 | pattern: /(!?\[)[^\]]+(?=\]$)/, 776 | lookbehind: true 777 | }, 778 | 'string': { 779 | pattern: /"(?:\\.|[^"\\])*"(?=\)$)/ 780 | } 781 | } 782 | } 783 | }); 784 | 785 | Prism.languages.markdown['bold'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']); 786 | Prism.languages.markdown['italic'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']); 787 | Prism.languages.markdown['bold'].inside['italic'] = Prism.util.clone(Prism.languages.markdown['italic']); 788 | Prism.languages.markdown['italic'].inside['bold'] = Prism.util.clone(Prism.languages.markdown['bold']); 789 | /** 790 | * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/ 791 | * Modified by Miles Johnson: http://milesj.me 792 | * 793 | * Supports the following: 794 | * - Extends clike syntax 795 | * - Support for PHP 5.3+ (namespaces, traits, generators, etc) 796 | * - Smarter constant and function matching 797 | * 798 | * Adds the following new token classes: 799 | * constant, delimiter, variable, function, package 800 | */ 801 | 802 | Prism.languages.php = Prism.languages.extend('clike', { 803 | 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, 804 | 'constant': /\b[A-Z0-9_]{2,}\b/, 805 | 'comment': { 806 | pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/, 807 | lookbehind: true 808 | } 809 | }); 810 | 811 | // Shell-like comments are matched after strings, because they are less 812 | // common than strings containing hashes... 813 | Prism.languages.insertBefore('php', 'class-name', { 814 | 'shell-comment': { 815 | pattern: /(^|[^\\])#.*/, 816 | lookbehind: true, 817 | alias: 'comment' 818 | } 819 | }); 820 | 821 | Prism.languages.insertBefore('php', 'keyword', { 822 | 'delimiter': /\?>|<\?(?:php)?/i, 823 | 'variable': /\$\w+\b/i, 824 | 'package': { 825 | pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, 826 | lookbehind: true, 827 | inside: { 828 | punctuation: /\\/ 829 | } 830 | } 831 | }); 832 | 833 | // Must be defined after the function pattern 834 | Prism.languages.insertBefore('php', 'operator', { 835 | 'property': { 836 | pattern: /(->)[\w]+/, 837 | lookbehind: true 838 | } 839 | }); 840 | 841 | // Add HTML support of the markup language exists 842 | if (Prism.languages.markup) { 843 | 844 | // Tokenize all inline PHP blocks that are wrapped in 845 | // This allows for easy PHP + markup highlighting 846 | Prism.hooks.add('before-highlight', function(env) { 847 | if (env.language !== 'php') { 848 | return; 849 | } 850 | 851 | env.tokenStack = []; 852 | 853 | env.backupCode = env.code; 854 | env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function(match) { 855 | env.tokenStack.push(match); 856 | 857 | return '{{{PHP' + env.tokenStack.length + '}}}'; 858 | }); 859 | }); 860 | 861 | // Restore env.code for other plugins (e.g. line-numbers) 862 | Prism.hooks.add('before-insert', function(env) { 863 | if (env.language === 'php') { 864 | env.code = env.backupCode; 865 | delete env.backupCode; 866 | } 867 | }); 868 | 869 | // Re-insert the tokens after highlighting 870 | Prism.hooks.add('after-highlight', function(env) { 871 | if (env.language !== 'php') { 872 | return; 873 | } 874 | 875 | for (var i = 0, t; t = env.tokenStack[i]; i++) { 876 | // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns 877 | env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$')); 878 | } 879 | 880 | env.element.innerHTML = env.highlightedCode; 881 | }); 882 | 883 | // Wrap tokens in classes that are missing them 884 | Prism.hooks.add('wrap', function(env) { 885 | if (env.language === 'php' && env.type === 'markup') { 886 | env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, "$1"); 887 | } 888 | }); 889 | 890 | // Add the rules before all others 891 | Prism.languages.insertBefore('php', 'comment', { 892 | 'markup': { 893 | pattern: /<[^?]\/?(.*?)>/, 894 | inside: Prism.languages.markup 895 | }, 896 | 'php': /\{\{\{PHP[0-9]+\}\}\}/ 897 | }); 898 | } 899 | ; 900 | Prism.languages.scss = Prism.languages.extend('css', { 901 | 'comment': { 902 | pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/, 903 | lookbehind: true 904 | }, 905 | 'atrule': { 906 | pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/, 907 | inside: { 908 | 'rule': /@[\w-]+/ 909 | // See rest below 910 | } 911 | }, 912 | // url, compassified 913 | 'url': /(?:[-a-z]+-)*url(?=\()/i, 914 | // CSS selector regex is not appropriate for Sass 915 | // since there can be lot more things (var, @ directive, nesting..) 916 | // a selector must start at the end of a property or after a brace (end of other rules or nesting) 917 | // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable 918 | // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var 919 | // can "pass" as a selector- e.g: proper#{$erty}) 920 | // this one was hard to do, so please be careful if you edit this one :) 921 | 'selector': { 922 | // Initial look-ahead is used to prevent matching of blank selectors 923 | pattern: /(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m, 924 | inside: { 925 | 'placeholder': /%[-_\w]+/ 926 | } 927 | } 928 | }); 929 | 930 | Prism.languages.insertBefore('scss', 'atrule', { 931 | 'keyword': [ 932 | /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i, 933 | { 934 | pattern: /( +)(?:from|through)(?= )/, 935 | lookbehind: true 936 | } 937 | ] 938 | }); 939 | 940 | Prism.languages.insertBefore('scss', 'property', { 941 | // var and interpolated vars 942 | 'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/ 943 | }); 944 | 945 | Prism.languages.insertBefore('scss', 'function', { 946 | 'placeholder': { 947 | pattern: /%[-_\w]+/, 948 | alias: 'selector' 949 | }, 950 | 'statement': /\B!(?:default|optional)\b/i, 951 | 'boolean': /\b(?:true|false)\b/, 952 | 'null': /\bnull\b/, 953 | 'operator': { 954 | pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/, 955 | lookbehind: true 956 | } 957 | }); 958 | 959 | Prism.languages.scss['atrule'].inside.rest = Prism.util.clone(Prism.languages.scss); 960 | Prism.languages.wiki = Prism.languages.extend('markup', { 961 | 'block-comment': { 962 | pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, 963 | lookbehind: true, 964 | alias: 'comment' 965 | }, 966 | 'heading': { 967 | pattern: /^(=+).+?\1/m, 968 | inside: { 969 | 'punctuation': /^=+|=+$/, 970 | 'important': /.+/ 971 | } 972 | }, 973 | 'emphasis': { 974 | // TODO Multi-line 975 | pattern: /('{2,5}).+?\1/, 976 | inside: { 977 | 'bold italic': { 978 | pattern: /(''''').+?(?=\1)/, 979 | lookbehind: true 980 | }, 981 | 'bold': { 982 | pattern: /(''')[^'](?:.*?[^'])?(?=\1)/, 983 | lookbehind: true 984 | }, 985 | 'italic': { 986 | pattern: /('')[^'](?:.*?[^'])?(?=\1)/, 987 | lookbehind: true 988 | }, 989 | 'punctuation': /^''+|''+$/ 990 | } 991 | }, 992 | 'hr': { 993 | pattern: /^-{4,}/m, 994 | alias: 'punctuation' 995 | }, 996 | 'url': [ 997 | /ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:RFC|PMID) +\d+/i, 998 | /\[\[.+?\]\]|\[.+?\]/ 999 | ], 1000 | 'variable': [ 1001 | /__[A-Z]+__/, 1002 | // FIXME Nested structures should be handled 1003 | // {{formatnum:{{#expr:{{{3}}}}}}} 1004 | /\{{3}.+?\}{3}/, 1005 | /\{\{.+?}}/ 1006 | ], 1007 | 'symbol': [ 1008 | /^#redirect/im, 1009 | /~{3,5}/ 1010 | ], 1011 | // Handle table attrs: 1012 | // {| 1013 | // ! style="text-align:left;"| Item 1014 | // |} 1015 | 'table-tag': { 1016 | pattern: /((?:^|[|!])[|!])[^|\r\n]+\|(?!\|)/m, 1017 | lookbehind: true, 1018 | inside: { 1019 | 'table-bar': { 1020 | pattern: /\|$/, 1021 | alias: 'punctuation' 1022 | }, 1023 | rest: Prism.languages.markup['tag'].inside 1024 | } 1025 | }, 1026 | 'punctuation': /^(?:\{\||\|\}|\|-|[*#:;!|])|\|\||!!/m 1027 | }); 1028 | 1029 | Prism.languages.insertBefore('wiki', 'tag', { 1030 | // Prevent highlighting inside , and
 tags
1031 | 	'nowiki': {
1032 | 		pattern: /<(nowiki|pre|source)\b[\w\W]*?>[\w\W]*?<\/\1>/i,
1033 | 		inside: {
1034 | 			'tag': {
1035 | 				pattern: /<(?:nowiki|pre|source)\b[\w\W]*?>|<\/(?:nowiki|pre|source)>/i,
1036 | 				inside: Prism.languages.markup['tag'].inside
1037 | 			}
1038 | 		}
1039 | 	}
1040 | });
1041 | 


--------------------------------------------------------------------------------
/assets/script.js:
--------------------------------------------------------------------------------
 1 | /* eslint-env browser */
 2 | /* global examples, Prism */
 3 | 
 4 | document.addEventListener('DOMContentLoaded', function () {
 5 | 	Array.prototype.forEach.call(document.querySelectorAll('pre code[class^="lang"]'), function (code) {
 6 | 		// set pre, wrap, opts, and get meta data from code
 7 | 		var pre  = code.parentNode;
 8 | 		var conf = {};
 9 | 		var text = String(code.textContent || code.innerText || '');
10 | 
11 | 		// get meta data from code class
12 | 		code.className.replace(/^lang-(\w+)(?::(\w+))?/, function ($0, $1, $2) {
13 | 			if ($2) return 'example:' + $2 + ',lang:' + $2;
14 | 
15 | 			if ($1 === 'example') return 'example:html';
16 | 
17 | 			return 'lang:' + $1;
18 | 		}).split(/\s*,\s*/).forEach(function (opt) {
19 | 			opt = opt.split(':');
20 | 
21 | 			conf[opt.shift().trim()] = opt.join(':').trim();
22 | 		});
23 | 
24 | 		code.removeAttribute('class');
25 | 
26 | 		// conditionally syntax highlight code
27 | 		if (conf.lang in Prism.languages) code.innerHTML = Prism.highlight(text, Prism.languages[conf.lang]);
28 | 
29 | 		// conditionally create code examples
30 | 		if (conf.example in examples.lang) {
31 | 			examples.lang[conf.example](pre, text, conf);
32 | 		}
33 | 	});
34 | });
35 | 


--------------------------------------------------------------------------------
/assets/style.css:
--------------------------------------------------------------------------------
  1 | .container {
  2 |   max-width: 100%;
  3 |   width: 100%;
  4 | }
  5 | 
  6 | .docs-example {
  7 |   display: flex;
  8 |   align-items: center;
  9 |   margin: 0 auto;
 10 |   justify-content: center;
 11 |   position: relative;
 12 | }
 13 | 
 14 | .docs-iframe {
 15 | }
 16 | 
 17 | .docs-example:hover .docs-iframe {
 18 | }
 19 | 
 20 | .docs-resize {
 21 |   width: 100%;
 22 | }
 23 | 
 24 | .docs-iframe {
 25 |   border: 0;
 26 |   height: auto;
 27 |   width: 100%;
 28 |   /* min-width: 320px; */
 29 |   /* max-width: 100%; */
 30 | }
 31 | 
 32 | /* .c-resize--left, */
 33 | /* .c-resize--right { */
 34 | /*   background-color: green; */
 35 | /*   display: inline-block; */
 36 | /*   width: 5px; */
 37 | /*   height: 20px; */
 38 | /* } */
 39 | 
 40 | .swatch {
 41 |   padding: .25em;
 42 |   margin: 0 .3em .3em 0;
 43 |   word-break: break-all;
 44 |   word-wrap: break-word;
 45 |   overflow: hidden;
 46 | }
 47 | 
 48 | .color-property {
 49 |   font-size: 80%;
 50 | }
 51 | 
 52 | /*---
 53 | section: mdcss GitHub
 54 | ---
 55 | [![NPM Version][npm-img]][npm] [![Build Status][ci-img]][ci]
 56 | [mdcss GitHub] is a theme for [mdcss] based on the documentation styles seen
 57 | across GitHub.
 58 | [ci]:      https://travis-ci.org/jonathantneal/mdcss-theme-github
 59 | [ci-img]:  https://img.shields.io/travis/jonathantneal/mdcss-theme-github.svg
 60 | [mdcss]:   https://github.com/jonathantneal/mdcss
 61 | [npm]:     https://www.npmjs.com/package/mdcss-theme-github
 62 | [npm-img]: https://img.shields.io/npm/v/mdcss-theme-github.svg
 63 | [mdcss GitHub]: https://github.com/jonathantneal/mdcss-theme-github
 64 | */
 65 | 
 66 | /*---
 67 | title:   Usage
 68 | section: mdcss GitHub
 69 | ---
 70 | Add [mdcss] and [mdcss GitHub] to your build tool:
 71 | ```bash
 72 | npm install mdcss mdcss-theme-github --save-dev
 73 | ```
 74 | Whenever [mdcss] is used, reference this theme.
 75 | ```js
 76 | require('mdcss')({
 77 | 	theme: require('mdcss-theme-github')({ /​* options *​/ })
 78 | })
 79 | ```
 80 | [mdcss]:   https://github.com/jonathantneal/mdcss
 81 | [mdcss GitHub]: https://github.com/jonathantneal/mdcss-theme-github
 82 | */
 83 | 
 84 | /*---
 85 | title:  Options
 86 | section: mdcss GitHub
 87 | ---
 88 | Options control the look and feel of the mdcss GitHub theme as well as any
 89 | iframe examples that may be used.
 90 | #### `title`
 91 | Type: `String`  
 92 | Default: `'Style Guide'`
 93 | The page title to be used by the style guide.
 94 | #### `logo`
 95 | Type: `String`  
 96 | Default: `'mdcss-logo.png'`
 97 | 
 98 | 
 99 | 
100 | The page logo to be used by the style guide.
101 | #### `examples.base`
102 | Type:    `String`  
103 | Default: `null`
104 | The base URL to use for all relative URLs contained within an example,
105 | including CSS and JavaScript references.
106 | #### `examples.target`
107 | Type:    `String`  
108 | Default: `'_self'`
109 | The frame to open example hyperlinks from within an example.
110 | #### `examples.css`
111 | Type:    `Array`  
112 | Default: `['style.css']`
113 | A list of CSS files to be used by examples.
114 | #### `examples.js`
115 | Type:    `Array`  
116 | Default: `null`
117 | A list of JavaScript files to be used by examples.
118 | #### `examples.bodyjs`
119 | Type:    `Array`  
120 | Default: `null`
121 | A list of JavaScript files to be used by examples, inserted after the example.
122 | #### `examples.htmlcss`
123 | Type:    `String`  
124 | Default: `'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:0;position:static;width:auto'`
125 | A string of styles applied to the `` wrapping the example. These default
126 | styles are used to create a seamless effect with the styleguide.
127 | #### `examples.bodycss`
128 | Type:    `String`  
129 | Default: `'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:16px;position:static;width:auto'`
130 | A string of styles applied to the `` wrapping the example. These default
131 | styles are used to create a seamless effect with the styleguide.
132 | */
133 | 
134 | /*---
135 | title:   Examples
136 | section: Overview
137 | ---
138 | The `example` keyword is used by code blocks to indicate that code will be
139 | rendered as a living example on the page.
140 | An `example:html` code block
141 | generates an iframe using the contents of the code block, followed by the
142 | original code block. For example:
143 | ````css
144 | ```example:html
145 | 
146 | ```
147 | ````
148 | is rendered as:
149 | ```example:html
150 | 
151 | ```
152 | An `example` code block generates an iframe using the contents of the code
153 | block without also rendering the original code block. For example:
154 | ````css
155 | ```example
156 | 
157 | ```
158 | ````
159 | is rendered as:
160 | ```example
161 | 
162 | ```
163 | */
164 | 
165 | /*---
166 | title:   Colors
167 | section: Overview
168 | ---
169 | Color examples are generated with `example:color` code blocks. For example:
170 | ````css
171 | ```example:color
172 | @color: #ffffff @name: White
173 | @color: #f8f8f8 @name: White Smoke
174 | @color: #e7e7e7 @name: Whisper
175 | @color: #777777 @name: Grey
176 | @color: #565454 @name: Matterhorn
177 | @color: #4078c0 @name: Steel Blue
178 | @color: #333333 @name: Night Rider
179 | ```
180 | ````
181 | is rendered as:
182 | ```example:color
183 | @color: #ffffff @name: White
184 | @color: #f8f8f8 @name: White Smoke
185 | @color: #e7e7e7 @name: Whisper
186 | @color: #777777 @name: Grey
187 | @color: #565454 @name: Matterhorn
188 | @color: #4078c0 @name: Steel Blue
189 | @color: #333333 @name: Night Rider
190 | ```
191 | */
192 | 
193 | /*---
194 | title:   Order
195 | section: Overview
196 | ---
197 | The `order` heading detail is used to control the order of sections in the generated style guide. A negative order value will shift the item before non-ordered items, while a positive order value will push the item after non-ordered values.
198 | ```css
199 | /*---
200 | section: First Section
201 | order: -1
202 | ---
203 | ```
204 | Attached to a subsection, the order detail will control the position of the subsection inside the section.
205 | ```css
206 | /*---
207 | title:   Last Subsection
208 | section: Third Section
209 | order: 1
210 | ---
211 | */
212 | 
213 | /*---
214 | title:   Typography
215 | section: Overview
216 | ---
217 | This theme uses a common Helvetica font stack with a relative line height of
218 | 1.6 times the font size.
219 | */
220 | 
221 | /*---
222 | title:   Headings
223 | section: Typography
224 | ---
225 | Headings match GitHub documentation conventions.
226 | ```example:html
227 | 

Heading Level 1

228 |

Heading Level 2

229 |

Heading Level 3

230 |

Heading Level 4

231 |
Heading Level 5
232 |
Heading Level 6
233 | ``` 234 | */ 235 | 236 | /*--- 237 | title: Iconography 238 | section: Overview 239 | --- 240 | This theme uses no iconography. 241 | */ 242 | 243 | /*--- 244 | title: Layout 245 | --- 246 | We use flex to horizontally stack the heading and main content areas. 247 | The navigation remains fixed while you scroll. 248 | */ 249 | 250 | /*--- 251 | title: Visual Language 252 | --- 253 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 254 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 255 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 256 | perferendis quam! Ullam, debitis ab maiores. 257 | ```html 258 |
259 |
260 | 261 |
262 |
263 | ``` 264 | */ 265 | 266 | /*--- 267 | title: Hero 268 | section: Visual Language 269 | --- 270 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 271 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 272 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 273 | perferendis quam! Ullam, debitis ab maiores. 274 | */ 275 | 276 | /*--- 277 | title: Figure 278 | section: Visual Language 279 | --- 280 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 281 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 282 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 283 | perferendis quam! Ullam, debitis ab maiores. 284 | */ 285 | 286 | /*--- 287 | title: Blockquote 288 | section: Visual Language 289 | --- 290 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 291 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 292 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 293 | perferendis quam! Ullam, debitis ab maiores. 294 | */ 295 | 296 | /*--- 297 | title: Media 298 | section: Visual Language 299 | --- 300 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 301 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 302 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 303 | perferendis quam! Ullam, debitis ab maiores. 304 | */ 305 | 306 | /*--- 307 | title: Aspect 308 | section: Visual Language 309 | order: -1 310 | --- 311 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 312 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 313 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 314 | perferendis quam! Ullam, debitis ab maiores. 315 | */ 316 | -------------------------------------------------------------------------------- /demo/anchor.js: -------------------------------------------------------------------------------- 1 | /** 2 | * AnchorJS - v3.2.0 - 2016-06-10 3 | * https://github.com/bryanbraun/anchorjs 4 | * Copyright (c) 2016 Bryan Braun; Licensed MIT 5 | */ 6 | 7 | /* eslint-env amd, node */ 8 | 9 | 'use strict'; 10 | 11 | // https://github.com/umdjs/umd/blob/master/templates/returnExports.js 12 | (function (root, factory) { 13 | if (typeof define === 'function' && define.amd) { 14 | // AMD. Register as an anonymous module. 15 | define([], factory); 16 | } else if (typeof module === 'object' && module.exports) { 17 | // Node. Does not work with strict CommonJS, but 18 | // only CommonJS-like environments that support module.exports, 19 | // like Node. 20 | module.exports = factory(); 21 | } else { 22 | // Browser globals (root is window) 23 | root.AnchorJS = factory(); 24 | root.anchors = new root.AnchorJS(); 25 | } 26 | }(this, function () { 27 | 28 | function AnchorJS(options) { 29 | this.options = options || {}; 30 | this.elements = []; 31 | 32 | /** 33 | * Assigns options to the internal options object, and provides defaults. 34 | * @param {Object} opts - Options object 35 | */ 36 | function _applyRemainingDefaultOptions(opts) { 37 | opts.icon = opts.hasOwnProperty('icon') ? opts.icon : '\ue9cb'; // Accepts characters (and also URLs?), like '#', '¶', '❡', or '§'. 38 | opts.visible = opts.hasOwnProperty('visible') ? opts.visible : 'hover'; // Also accepts 'always' & 'touch' 39 | opts.placement = opts.hasOwnProperty('placement') ? opts.placement : 'right'; // Also accepts 'left' 40 | opts.class = opts.hasOwnProperty('class') ? opts.class : ''; // Accepts any class name. 41 | // Using Math.floor here will ensure the value is Number-cast and an integer. 42 | opts.truncate = opts.hasOwnProperty('truncate') ? Math.floor(opts.truncate) : 64; // Accepts any value that can be typecast to a number. 43 | } 44 | 45 | _applyRemainingDefaultOptions(this.options); 46 | 47 | /** 48 | * Checks to see if this device supports touch. Uses criteria pulled from Modernizr: 49 | * https://github.com/Modernizr/Modernizr/blob/da22eb27631fc4957f67607fe6042e85c0a84656/feature-detects/touchevents.js#L40 50 | * @return {Boolean} - true if the current device supports touch. 51 | */ 52 | this.isTouchDevice = function() { 53 | return !!(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch); 54 | }; 55 | 56 | /** 57 | * Add anchor links to page elements. 58 | * @param {String|Array|Nodelist} selector - A CSS selector for targeting the elements you wish to add anchor links 59 | * to. Also accepts an array or nodeList containing the relavant elements. 60 | * @return {this} - The AnchorJS object 61 | */ 62 | this.add = function(selector) { 63 | var elements, 64 | elsWithIds, 65 | idList, 66 | elementID, 67 | i, 68 | index, 69 | count, 70 | tidyText, 71 | newTidyText, 72 | readableID, 73 | anchor, 74 | visibleOptionToUse, 75 | indexesToDrop = []; 76 | 77 | // We reapply options here because somebody may have overwritten the default options object when setting options. 78 | // For example, this overwrites all options but visible: 79 | // 80 | // anchors.options = { visible: 'always'; } 81 | _applyRemainingDefaultOptions(this.options); 82 | 83 | visibleOptionToUse = this.options.visible; 84 | if (visibleOptionToUse === 'touch') { 85 | visibleOptionToUse = this.isTouchDevice() ? 'always' : 'hover'; 86 | } 87 | 88 | // Provide a sensible default selector, if none is given. 89 | if (!selector) { 90 | selector = 'h1, h2, h3, h4, h5, h6'; 91 | } 92 | 93 | elements = _getElements(selector); 94 | 95 | if (elements.length === 0) { 96 | return false; 97 | } 98 | 99 | _addBaselineStyles(); 100 | 101 | // We produce a list of existing IDs so we don't generate a duplicate. 102 | elsWithIds = document.querySelectorAll('[id]'); 103 | idList = [].map.call(elsWithIds, function assign(el) { 104 | return el.id; 105 | }); 106 | 107 | for (i = 0; i < elements.length; i++) { 108 | if (this.hasAnchorJSLink(elements[i])) { 109 | indexesToDrop.push(i); 110 | continue; 111 | } 112 | 113 | if (elements[i].hasAttribute('id')) { 114 | elementID = elements[i].getAttribute('id'); 115 | } else { 116 | tidyText = this.urlify(elements[i].textContent); 117 | 118 | // Compare our generated ID to existing IDs (and increment it if needed) 119 | // before we add it to the page. 120 | newTidyText = tidyText; 121 | count = 0; 122 | do { 123 | if (index !== undefined) { 124 | newTidyText = tidyText + '-' + count; 125 | } 126 | 127 | index = idList.indexOf(newTidyText); 128 | count += 1; 129 | } while (index !== -1); 130 | index = undefined; 131 | idList.push(newTidyText); 132 | 133 | elements[i].setAttribute('id', newTidyText); 134 | elementID = newTidyText; 135 | } 136 | 137 | readableID = elementID.replace(/-/g, ' '); 138 | 139 | // The following code builds the following DOM structure in a more effiecient (albeit opaque) way. 140 | // ''; 141 | anchor = document.createElement('a'); 142 | anchor.className = 'anchorjs-link ' + this.options.class; 143 | anchor.href = '#' + elementID; 144 | anchor.setAttribute('aria-label', 'Anchor link for: ' + readableID); 145 | anchor.setAttribute('data-anchorjs-icon', this.options.icon); 146 | 147 | if (visibleOptionToUse === 'always') { 148 | anchor.style.opacity = '1'; 149 | } 150 | 151 | if (this.options.icon === '\ue9cb') { 152 | anchor.style.fontFamily = 'anchorjs-icons'; 153 | anchor.style.fontStyle = 'normal'; 154 | anchor.style.fontVariant = 'normal'; 155 | anchor.style.fontWeight = 'normal'; 156 | anchor.style.lineHeight = 1; 157 | 158 | // We set lineHeight = 1 here because the `anchorjs-icons` font family could otherwise affect the 159 | // height of the heading. This isn't the case for icons with `placement: left`, so we restore 160 | // line-height: inherit in that case, ensuring they remain positioned correctly. For more info, 161 | // see https://github.com/bryanbraun/anchorjs/issues/39. 162 | if (this.options.placement === 'left') { 163 | anchor.style.lineHeight = 'inherit'; 164 | } 165 | } 166 | 167 | if (this.options.placement === 'left') { 168 | anchor.style.position = 'absolute'; 169 | anchor.style.marginLeft = '-1em'; 170 | anchor.style.paddingRight = '0.5em'; 171 | elements[i].insertBefore(anchor, elements[i].firstChild); 172 | } else { // if the option provided is `right` (or anything else). 173 | anchor.style.paddingLeft = '0.375em'; 174 | elements[i].appendChild(anchor); 175 | } 176 | } 177 | 178 | for (i = 0; i < indexesToDrop.length; i++) { 179 | elements.splice(indexesToDrop[i] - i, 1); 180 | } 181 | this.elements = this.elements.concat(elements); 182 | 183 | return this; 184 | }; 185 | 186 | /** 187 | * Removes all anchorjs-links from elements targed by the selector. 188 | * @param {String|Array|Nodelist} selector - A CSS selector string targeting elements with anchor links, 189 | * OR a nodeList / array containing the DOM elements. 190 | * @return {this} - The AnchorJS object 191 | */ 192 | this.remove = function(selector) { 193 | var index, 194 | domAnchor, 195 | elements = _getElements(selector); 196 | 197 | for (var i = 0; i < elements.length; i++) { 198 | domAnchor = elements[i].querySelector('.anchorjs-link'); 199 | if (domAnchor) { 200 | // Drop the element from our main list, if it's in there. 201 | index = this.elements.indexOf(elements[i]); 202 | if (index !== -1) { 203 | this.elements.splice(index, 1); 204 | } 205 | // Remove the anchor from the DOM. 206 | elements[i].removeChild(domAnchor); 207 | } 208 | } 209 | return this; 210 | }; 211 | 212 | /** 213 | * Removes all anchorjs links. Mostly used for tests. 214 | */ 215 | this.removeAll = function() { 216 | this.remove(this.elements); 217 | }; 218 | 219 | /** 220 | * Urlify - Refine text so it makes a good ID. 221 | * 222 | * To do this, we remove apostrophes, replace nonsafe characters with hyphens, 223 | * remove extra hyphens, truncate, trim hyphens, and make lowercase. 224 | * 225 | * @param {String} text - Any text. Usually pulled from the webpage element we are linking to. 226 | * @return {String} - hyphen-delimited text for use in IDs and URLs. 227 | */ 228 | this.urlify = function(text) { 229 | // Regex for finding the nonsafe URL characters (many need escaping): & +$,:;=?@"#{}|^~[`%!']./()*\ 230 | var nonsafeChars = /[& +$,:;=?@"#{}|^~[`%!'\]\.\/\(\)\*\\]/g, 231 | urlText; 232 | 233 | // The reason we include this _applyRemainingDefaultOptions is so urlify can be called independently, 234 | // even after setting options. This can be useful for tests or other applications. 235 | if (!this.options.truncate) { 236 | _applyRemainingDefaultOptions(this.options); 237 | } 238 | 239 | // Note: we trim hyphens after truncating because truncating can cause dangling hyphens. 240 | // Example string: // " ⚡⚡ Don't forget: URL fragments should be i18n-friendly, hyphenated, short, and clean." 241 | urlText = text.trim() // "⚡⚡ Don't forget: URL fragments should be i18n-friendly, hyphenated, short, and clean." 242 | .replace(/\'/gi, '') // "⚡⚡ Dont forget: URL fragments should be i18n-friendly, hyphenated, short, and clean." 243 | .replace(nonsafeChars, '-') // "⚡⚡-Dont-forget--URL-fragments-should-be-i18n-friendly--hyphenated--short--and-clean-" 244 | .replace(/-{2,}/g, '-') // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated-short-and-clean-" 245 | .substring(0, this.options.truncate) // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated-" 246 | .replace(/^-+|-+$/gm, '') // "⚡⚡-Dont-forget-URL-fragments-should-be-i18n-friendly-hyphenated" 247 | .toLowerCase(); // "⚡⚡-dont-forget-url-fragments-should-be-i18n-friendly-hyphenated" 248 | 249 | return urlText; 250 | }; 251 | 252 | /** 253 | * Determines if this element already has an AnchorJS link on it. 254 | * Uses this technique: http://stackoverflow.com/a/5898748/1154642 255 | * @param {HTMLElemnt} el - a DOM node 256 | * @return {Boolean} true/false 257 | */ 258 | this.hasAnchorJSLink = function(el) { 259 | var hasLeftAnchor = el.firstChild && ((' ' + el.firstChild.className + ' ').indexOf(' anchorjs-link ') > -1), 260 | hasRightAnchor = el.lastChild && ((' ' + el.lastChild.className + ' ').indexOf(' anchorjs-link ') > -1); 261 | 262 | return hasLeftAnchor || hasRightAnchor || false; 263 | }; 264 | 265 | /** 266 | * Turns a selector, nodeList, or array of elements into an array of elements (so we can use array methods). 267 | * It also throws errors on any other inputs. Used to handle inputs to .add and .remove. 268 | * @param {String|Array|Nodelist} input - A CSS selector string targeting elements with anchor links, 269 | * OR a nodeList / array containing the DOM elements. 270 | * @return {Array} - An array containing the elements we want. 271 | */ 272 | function _getElements(input) { 273 | var elements; 274 | if (typeof input === 'string' || input instanceof String) { 275 | // See https://davidwalsh.name/nodelist-array for the technique transforming nodeList -> Array. 276 | elements = [].slice.call(document.querySelectorAll(input)); 277 | // I checked the 'input instanceof NodeList' test in IE9 and modern browsers and it worked for me. 278 | } else if (Array.isArray(input) || input instanceof NodeList) { 279 | elements = [].slice.call(input); 280 | } else { 281 | throw new Error('The selector provided to AnchorJS was invalid.'); 282 | } 283 | return elements; 284 | } 285 | 286 | /** 287 | * _addBaselineStyles 288 | * Adds baseline styles to the page, used by all AnchorJS links irregardless of configuration. 289 | */ 290 | function _addBaselineStyles() { 291 | // We don't want to add global baseline styles if they've been added before. 292 | if (document.head.querySelector('style.anchorjs') !== null) { 293 | return; 294 | } 295 | 296 | var style = document.createElement('style'), 297 | linkRule = 298 | ' .anchorjs-link {' + 299 | ' opacity: 0;' + 300 | ' text-decoration: none;' + 301 | ' -webkit-font-smoothing: antialiased;' + 302 | ' -moz-osx-font-smoothing: grayscale;' + 303 | ' }', 304 | hoverRule = 305 | ' *:hover > .anchorjs-link,' + 306 | ' .anchorjs-link:focus {' + 307 | ' opacity: 1;' + 308 | ' }', 309 | anchorjsLinkFontFace = 310 | ' @font-face {' + 311 | ' font-family: "anchorjs-icons";' + 312 | ' font-style: normal;' + 313 | ' font-weight: normal;' + // Icon from icomoon; 10px wide & 10px tall; 2 empty below & 4 above 314 | ' src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype");' + 315 | ' }', 316 | pseudoElContent = 317 | ' [data-anchorjs-icon]::after {' + 318 | ' content: attr(data-anchorjs-icon);' + 319 | ' }', 320 | firstStyleEl; 321 | 322 | style.className = 'anchorjs'; 323 | style.appendChild(document.createTextNode('')); // Necessary for Webkit. 324 | 325 | // We place it in the head with the other style tags, if possible, so as to 326 | // not look out of place. We insert before the others so these styles can be 327 | // overridden if necessary. 328 | firstStyleEl = document.head.querySelector('[rel="stylesheet"], style'); 329 | if (firstStyleEl === undefined) { 330 | document.head.appendChild(style); 331 | } else { 332 | document.head.insertBefore(style, firstStyleEl); 333 | } 334 | 335 | style.sheet.insertRule(linkRule, style.sheet.cssRules.length); 336 | style.sheet.insertRule(hoverRule, style.sheet.cssRules.length); 337 | style.sheet.insertRule(pseudoElContent, style.sheet.cssRules.length); 338 | style.sheet.insertRule(anchorjsLinkFontFace, style.sheet.cssRules.length); 339 | } 340 | } 341 | 342 | return AnchorJS; 343 | })); 344 | -------------------------------------------------------------------------------- /demo/anchor.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * AnchorJS - v3.2.0 - 2016-06-10 3 | * https://github.com/bryanbraun/anchorjs 4 | * Copyright (c) 2016 Bryan Braun; Licensed MIT 5 | */ 6 | "use strict";!function(A,e){"function"==typeof define&&define.amd?define([],e):"object"==typeof module&&module.exports?module.exports=e():(A.AnchorJS=e(),A.anchors=new A.AnchorJS)}(this,function(){function A(A){function e(A){A.icon=A.hasOwnProperty("icon")?A.icon:"",A.visible=A.hasOwnProperty("visible")?A.visible:"hover",A.placement=A.hasOwnProperty("placement")?A.placement:"right",A.class=A.hasOwnProperty("class")?A.class:"",A.truncate=A.hasOwnProperty("truncate")?Math.floor(A.truncate):64}function t(A){var e;if("string"==typeof A||A instanceof String)e=[].slice.call(document.querySelectorAll(A));else{if(!(Array.isArray(A)||A instanceof NodeList))throw new Error("The selector provided to AnchorJS was invalid.");e=[].slice.call(A)}return e}function n(){if(null===document.head.querySelector("style.anchorjs")){var A,e=document.createElement("style"),t=" .anchorjs-link { opacity: 0; text-decoration: none; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }",n=" *:hover > .anchorjs-link, .anchorjs-link:focus { opacity: 1; }",o=' @font-face { font-family: "anchorjs-icons"; font-style: normal; font-weight: normal; src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg8SBTUAAAC8AAAAYGNtYXAWi9QdAAABHAAAAFRnYXNwAAAAEAAAAXAAAAAIZ2x5Zgq29TcAAAF4AAABNGhlYWQEZM3pAAACrAAAADZoaGVhBhUDxgAAAuQAAAAkaG10eASAADEAAAMIAAAAFGxvY2EAKACuAAADHAAAAAxtYXhwAAgAVwAAAygAAAAgbmFtZQ5yJ3cAAANIAAAB2nBvc3QAAwAAAAAFJAAAACAAAwJAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAAADpywPA/8AAQAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAADAAAAAwAAABwAAQADAAAAHAADAAEAAAAcAAQAOAAAAAoACAACAAIAAQAg6cv//f//AAAAAAAg6cv//f//AAH/4xY5AAMAAQAAAAAAAAAAAAAAAQAB//8ADwABAAAAAAAAAAAAAgAANzkBAAAAAAEAAAAAAAAAAAACAAA3OQEAAAAAAQAAAAAAAAAAAAIAADc5AQAAAAACADEARAJTAsAAKwBUAAABIiYnJjQ/AT4BMzIWFxYUDwEGIicmND8BNjQnLgEjIgYPAQYUFxYUBw4BIwciJicmND8BNjIXFhQPAQYUFx4BMzI2PwE2NCcmNDc2MhcWFA8BDgEjARQGDAUtLXoWOR8fORYtLTgKGwoKCjgaGg0gEhIgDXoaGgkJBQwHdR85Fi0tOAobCgoKOBoaDSASEiANehoaCQkKGwotLXoWOR8BMwUFLYEuehYXFxYugC44CQkKGwo4GkoaDQ0NDXoaShoKGwoFBe8XFi6ALjgJCQobCjgaShoNDQ0NehpKGgobCgoKLYEuehYXAAEAAAABAACiToc1Xw889QALBAAAAAAA0XnFFgAAAADRecUWAAAAAAJTAsAAAAAIAAIAAAAAAAAAAQAAA8D/wAAABAAAAAAAAlMAAQAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAACAAAAAoAAMQAAAAAACgAUAB4AmgABAAAABQBVAAIAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAADgCuAAEAAAAAAAEADgAAAAEAAAAAAAIABwCfAAEAAAAAAAMADgBLAAEAAAAAAAQADgC0AAEAAAAAAAUACwAqAAEAAAAAAAYADgB1AAEAAAAAAAoAGgDeAAMAAQQJAAEAHAAOAAMAAQQJAAIADgCmAAMAAQQJAAMAHABZAAMAAQQJAAQAHADCAAMAAQQJAAUAFgA1AAMAAQQJAAYAHACDAAMAAQQJAAoANAD4YW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzVmVyc2lvbiAxLjAAVgBlAHIAcwBpAG8AbgAgADEALgAwYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzUmVndWxhcgBSAGUAZwB1AGwAYQByYW5jaG9yanMtaWNvbnMAYQBuAGMAaABvAHIAagBzAC0AaQBjAG8AbgBzRm9udCBnZW5lcmF0ZWQgYnkgSWNvTW9vbi4ARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format("truetype"); }',i=" [data-anchorjs-icon]::after { content: attr(data-anchorjs-icon); }";e.className="anchorjs",e.appendChild(document.createTextNode("")),A=document.head.querySelector('[rel="stylesheet"], style'),void 0===A?document.head.appendChild(e):document.head.insertBefore(e,A),e.sheet.insertRule(t,e.sheet.cssRules.length),e.sheet.insertRule(n,e.sheet.cssRules.length),e.sheet.insertRule(i,e.sheet.cssRules.length),e.sheet.insertRule(o,e.sheet.cssRules.length)}}this.options=A||{},this.elements=[],e(this.options),this.isTouchDevice=function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)},this.add=function(A){var o,i,s,a,r,c,l,h,u,g,B,f,d=[];if(e(this.options),f=this.options.visible,"touch"===f&&(f=this.isTouchDevice()?"always":"hover"),A||(A="h1, h2, h3, h4, h5, h6"),o=t(A),0===o.length)return!1;for(n(),i=document.querySelectorAll("[id]"),s=[].map.call(i,function(A){return A.id}),r=0;r-1,t=A.lastChild&&(" "+A.lastChild.className+" ").indexOf(" anchorjs-link ")>-1;return e||t||!1}}return A}); 7 | -------------------------------------------------------------------------------- /demo/examples.js: -------------------------------------------------------------------------------- 1 | examples.lang = { 2 | color: function (pre, value) { 3 | var colors = pre.parentNode.insertBefore(document.createElement('div'), pre); 4 | var lines = value.trim().split(/\n+/); 5 | 6 | colors.className = 'colors'; 7 | 8 | lines.map(parseLine).map(parseColor).forEach(colors.appendChild, colors); 9 | 10 | function parseLine(line) { 11 | line = line.trim(); 12 | 13 | var color = {}; 14 | var match = /@([^:]+):\s*(.+?)(?=\s+@|$)/g; 15 | var prop; 16 | 17 | while (prop = match.exec(line)) color[prop[1]] = prop[2]; 18 | 19 | return color; 20 | } 21 | 22 | function parseColor(color) { 23 | var colorNode = document.createElement('div'); 24 | 25 | colorNode.className = 'swatch'; 26 | 27 | colorNode.style.backgroundColor = color.color; 28 | 29 | var contrastColor = contrast(color.color); 30 | 31 | colorNode.style.color = contrastColor; 32 | 33 | colorNode.style.textShadow = '0 0 1px ' + (contrastColor === '#ffffff' ? '#000000' : '#ffffff'); 34 | 35 | colorNode.appendChild(document.createTextNode(color.color)); 36 | 37 | Object.keys(color).filter(function (key) { return key !== 'color' }).forEach(function (key) { 38 | var propertyNode = colorNode.appendChild(document.createElement('div')); 39 | 40 | propertyNode.className = 'color-property'; 41 | 42 | propertyNode.setAttribute('data-name', key); 43 | 44 | propertyNode.appendChild(document.createTextNode(color[key])); 45 | }); 46 | 47 | return colorNode; 48 | } 49 | 50 | function hex2rgb(hex) { 51 | var bigint = parseInt(hex.slice(1).replace(/^([0-9a-f])([0-9a-f])([0-9a-f])$/i, '$1$1$2$2$3$3'), 16); 52 | var r = (bigint >> 16) & 255; 53 | var g = (bigint >> 8) & 255; 54 | var b = bigint & 255; 55 | 56 | return [r, g, b]; 57 | } 58 | 59 | function getRGB(color) { 60 | return /^#/.test(color) ? hex2rgb(color) : color.replace(/[^\d,]+/g, '').split(/,/).map(function (part) { return part * 1; }); 61 | } 62 | 63 | function contrast(color) { 64 | var rgb = getRGB(color); 65 | var o = Math.round(((parseInt(rgb[0]) * 299) + (parseInt(rgb[1]) * 587) + (parseInt(rgb[2]) * 114)) / 1000); 66 | 67 | return o <= 180 ? '#ffffff' : '#000000'; 68 | } 69 | }, 70 | html: function (pre, value, conf) { 71 | // get wrap 72 | var wrap = pre.parentNode; 73 | pre.className = 'highlight'; 74 | 75 | var preview = wrap.insertBefore(document.createElement('div'), pre); 76 | preview.className = 'docs-example clearfix'; 77 | 78 | var resizeDiv = preview.appendChild(document.createElement('div')); 79 | resizeDiv.className = 'docs-resize'; 80 | 81 | var resizeLeft = resizeDiv.appendChild(document.createElement('span')); 82 | resizeLeft.className = 'c-resize--left'; 83 | 84 | var iframe = resizeDiv.appendChild(document.createElement('iframe')); 85 | iframe.className = 'docs-iframe'; 86 | var style = iframe.style; 87 | 88 | var resizeRight = resizeDiv.appendChild(document.createElement('span')); 89 | resizeRight.className = 'c-resize--right'; 90 | 91 | // get iframe dom 92 | var iwin = iframe.contentWindow; 93 | var idoc = iwin.document; 94 | 95 | // write example content to iframe 96 | idoc.open(); 97 | 98 | var html = ''; 103 | 104 | html += examples.css.map(function (css) { 105 | return ''; 106 | }).join(''); 107 | 108 | html += examples.js.map(function (js) { 109 | return ''; 110 | }).join(''); 111 | 112 | html += value; 113 | 114 | html += examples.bodyjs.map(function (js) { 115 | return ''; 116 | }).join(''); 117 | 118 | idoc.write(html); 119 | 120 | idoc.close(); 121 | 122 | // add default block styles to iframe dom 123 | iwin.addEventListener('load', function(){ 124 | idoc.documentElement.setAttribute('style', examples.htmlcss); 125 | idoc.body.setAttribute('style', examples.bodycss); 126 | iframe.setAttribute('class', 'docs-example clearfix'); 127 | }); 128 | 129 | if (conf.width) style.width = String(conf.width); 130 | 131 | // set iframe height based on content 132 | var documentElement = idoc.documentElement; 133 | var scrollHeight; 134 | 135 | function resizeIFrame() { 136 | var currentScrollHeight = documentElement.scrollHeight; 137 | 138 | if (scrollHeight !== currentScrollHeight) { 139 | scrollHeight = currentScrollHeight; 140 | 141 | style.height = 0; 142 | 143 | style.height = documentElement.scrollHeight + (iframe.offsetHeight - iwin.innerHeight) + 'px'; 144 | } 145 | } 146 | 147 | iwin.addEventListener('load', function () { 148 | resizeIFrame(); 149 | }); 150 | } 151 | }; 152 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | GitHub Theme 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 18 | 23 |
24 |
25 | 26 |
27 |
28 |
29 | 90 |
91 | 92 |
93 | 94 |
95 |

mdcss GitHub

96 | 97 |
98 | 99 | 100 |
101 | 102 | 103 |
104 |

NPM Version Build Status 105 | mdcss GitHub is a theme for mdcss based on the documentation styles seen 106 | across GitHub.

107 | 108 | 109 |
110 |
111 | 112 |
113 |

Usage

114 | 115 |
116 |

Add mdcss and mdcss GitHub to your build tool:

117 |
npm install mdcss mdcss-theme-github --save-dev
118 | 
119 |

Whenever mdcss is used, reference this theme.

120 |
require('mdcss')({
121 |     theme: require('mdcss-theme-github')({ /​* options *​/ })
122 | })
123 | 
124 | 125 | 126 |
127 |
128 | 129 |
130 |

Options

131 | 132 |
133 |

Options control the look and feel of the mdcss GitHub theme as well as any 134 | iframe examples that may be used.

135 |

title

136 |

Type: String
Default: 'Style Guide' 137 | The page title to be used by the style guide.

138 |

logo

139 |

Type: String
Default: 'mdcss-logo.png'

140 |

141 |

The page logo to be used by the style guide.

142 |

examples.base

143 |

Type: String
Default: null 144 | The base URL to use for all relative URLs contained within an example, 145 | including CSS and JavaScript references.

146 |

examples.target

147 |

Type: String
Default: '_self' 148 | The frame to open example hyperlinks from within an example.

149 |

examples.css

150 |

Type: Array
Default: ['style.css'] 151 | A list of CSS files to be used by examples.

152 |

examples.js

153 |

Type: Array
Default: null 154 | A list of JavaScript files to be used by examples.

155 |

examples.bodyjs

156 |

Type: Array
Default: null 157 | A list of JavaScript files to be used by examples, inserted after the example.

158 |

examples.htmlcss

159 |

Type: String
Default: 'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:0;position:static;width:auto' 160 | A string of styles applied to the <html> wrapping the example. These default 161 | styles are used to create a seamless effect with the styleguide.

162 |

examples.bodycss

163 |

Type: String
Default: 'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:16px;position:static;width:auto' 164 | A string of styles applied to the <body> wrapping the example. These default 165 | styles are used to create a seamless effect with the styleguide.

166 | 167 | 168 |
169 |
170 | 171 |
172 |
173 | 174 |
175 |

Overview

176 | 177 |
178 | 179 | 180 |
181 |

Examples

182 | 183 |
184 |

The example keyword is used by code blocks to indicate that code will be 185 | rendered as a living example on the page. 186 | An example:html code block 187 | generates an iframe using the contents of the code block, followed by the 188 | original code block. For example:

189 |
```example:html
190 | <button class="btn">This is a button</button>
191 | ```
192 | 
193 |

is rendered as:

194 |
<button class="btn">This is a button</button>
195 | 
196 |

An example code block generates an iframe using the contents of the code 197 | block without also rendering the original code block. For example:

198 |
```example
199 | <button class="btn">This is a button</button>
200 | ```
201 | 
202 |

is rendered as:

203 |
<button class="btn">This is a button</button>
204 | 
205 | 206 | 207 |
208 |
209 | 210 |
211 |

Colors

212 | 213 |
214 |

Color examples are generated with example:color code blocks. For example:

215 |
```example:color
216 | @color: #ffffff @name: White
217 | @color: #f8f8f8 @name: White Smoke
218 | @color: #e7e7e7 @name: Whisper
219 | @color: #777777 @name: Grey
220 | @color: #565454 @name: Matterhorn
221 | @color: #4078c0 @name: Steel Blue
222 | @color: #333333 @name: Night Rider
223 | ```
224 | 
225 |

is rendered as:

226 |
@color: #ffffff @name: White
227 | @color: #f8f8f8 @name: White Smoke
228 | @color: #e7e7e7 @name: Whisper
229 | @color: #777777 @name: Grey
230 | @color: #565454 @name: Matterhorn
231 | @color: #4078c0 @name: Steel Blue
232 | @color: #333333 @name: Night Rider
233 | 
234 | 235 | 236 |
237 |
238 | 239 |
240 |

Order

241 | 242 |
243 |

The order heading detail is used to control the order of sections in the generated style guide. A negative order value will shift the item before non-ordered items, while a positive order value will push the item after non-ordered values.

244 |
/*---
245 | section: First Section
246 | order: -1
247 | ---
248 | 
249 |

Attached to a subsection, the order detail will control the position of the subsection inside the section. 250 | ```css 251 | /*--- 252 | title: Last Subsection 253 | section: Third Section

254 |

order: 1

255 | 256 | 257 |
258 |
259 | 260 |
261 |

Typography

262 | 263 |
264 |

This theme uses a common Helvetica font stack with a relative line height of 265 | 1.6 times the font size.

266 | 267 | 268 |
269 |

Headings

270 | 271 |
272 |

Headings match GitHub documentation conventions.

273 |
<h1>Heading Level 1</h1>
274 | <h2>Heading Level 2</h2>
275 | <h3>Heading Level 3</h3>
276 | <h4>Heading Level 4</h4>
277 | <h5>Heading Level 5</h5>
278 | <h6>Heading Level 6</h6>
279 | 
280 | 281 | 282 |
283 |
284 | 285 |
286 |
287 | 288 |
289 |

Iconography

290 | 291 |
292 |

This theme uses no iconography.

293 | 294 | 295 |
296 |
297 | 298 |
299 |
300 | 301 |
302 |

Layout

303 | 304 |
305 |

We use flex to horizontally stack the heading and main content areas. 306 | The navigation remains fixed while you scroll.

307 | 308 | 309 |
310 |
311 | 312 |
313 |

Visual Language

314 | 315 |
316 |

This is just a sample section. Lorem ipsum dolor sit amet, consectetur 317 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 318 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 319 | perferendis quam! Ullam, debitis ab maiores.

320 |
<form class="a-particularly-long-class-name">
321 |     <fieldset class="control-group">
322 |         <input class="control-input" type="text" value="A particularly long value for an input control">
323 |     </fieldset>
324 | </form>
325 | 
326 | 327 | 328 |
329 |

Aspect

330 | 331 |
332 |

This is just a sample section. Lorem ipsum dolor sit amet, consectetur 333 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 334 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 335 | perferendis quam! Ullam, debitis ab maiores.

336 | 337 | 338 |
339 |
340 | 341 |
342 |

Hero

343 | 344 |
345 |

This is just a sample section. Lorem ipsum dolor sit amet, consectetur 346 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 347 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 348 | perferendis quam! Ullam, debitis ab maiores.

349 | 350 | 351 |
352 |
353 | 354 |
355 |

Figure

356 | 357 |
358 |

This is just a sample section. Lorem ipsum dolor sit amet, consectetur 359 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 360 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 361 | perferendis quam! Ullam, debitis ab maiores.

362 | 363 | 364 |
365 |
366 | 367 |
368 |

Blockquote

369 | 370 |
371 |

This is just a sample section. Lorem ipsum dolor sit amet, consectetur 372 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 373 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 374 | perferendis quam! Ullam, debitis ab maiores.

375 | 376 | 377 |
378 |
379 | 380 |
381 |

Media

382 | 383 |
384 |

This is just a sample section. Lorem ipsum dolor sit amet, consectetur 385 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 386 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 387 | perferendis quam! Ullam, debitis ab maiores.

388 | 389 | 390 |
391 |
392 | 393 |
394 |
395 | 396 |
397 |
398 |
399 | Last modified Thursday, 23 June 2016 13:21 400 |
401 |
402 | 403 | 404 | 405 | 406 | 407 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | -------------------------------------------------------------------------------- /demo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/demo/logo.png -------------------------------------------------------------------------------- /demo/mdcss-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/demo/mdcss-logo.png -------------------------------------------------------------------------------- /demo/octicons/octicons-local.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/demo/octicons/octicons-local.ttf -------------------------------------------------------------------------------- /demo/octicons/octicons.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: 'octicons'; 3 | src: url('octicons.eot?#iefix') format('embedded-opentype'), 4 | url('octicons.woff') format('woff'), 5 | url('octicons.ttf') format('truetype'), 6 | url('octicons.svg#octicons') format('svg'); 7 | font-weight: normal; 8 | font-style: normal; 9 | } 10 | 11 | /* 12 | 13 | .octicon is optimized for 16px. 14 | .mega-octicon is optimized for 32px but can be used larger. 15 | 16 | */ 17 | .octicon, .mega-octicon { 18 | font: normal normal normal 16px/1 octicons; 19 | display: inline-block; 20 | text-decoration: none; 21 | text-rendering: auto; 22 | -webkit-font-smoothing: antialiased; 23 | -moz-osx-font-smoothing: grayscale; 24 | -webkit-user-select: none; 25 | -moz-user-select: none; 26 | -ms-user-select: none; 27 | user-select: none; 28 | } 29 | .mega-octicon { font-size: 32px; } 30 | 31 | .octicon-alert:before { content: '\f02d'} /*  */ 32 | .octicon-arrow-down:before { content: '\f03f'} /*  */ 33 | .octicon-arrow-left:before { content: '\f040'} /*  */ 34 | .octicon-arrow-right:before { content: '\f03e'} /*  */ 35 | .octicon-arrow-small-down:before { content: '\f0a0'} /*  */ 36 | .octicon-arrow-small-left:before { content: '\f0a1'} /*  */ 37 | .octicon-arrow-small-right:before { content: '\f071'} /*  */ 38 | .octicon-arrow-small-up:before { content: '\f09f'} /*  */ 39 | .octicon-arrow-up:before { content: '\f03d'} /*  */ 40 | .octicon-microscope:before, 41 | .octicon-beaker:before { content: '\f0dd'} /*  */ 42 | .octicon-bell:before { content: '\f0de'} /*  */ 43 | .octicon-bold:before { content: '\f0e2'} /*  */ 44 | .octicon-book:before { content: '\f007'} /*  */ 45 | .octicon-bookmark:before { content: '\f07b'} /*  */ 46 | .octicon-briefcase:before { content: '\f0d3'} /*  */ 47 | .octicon-broadcast:before { content: '\f048'} /*  */ 48 | .octicon-browser:before { content: '\f0c5'} /*  */ 49 | .octicon-bug:before { content: '\f091'} /*  */ 50 | .octicon-calendar:before { content: '\f068'} /*  */ 51 | .octicon-check:before { content: '\f03a'} /*  */ 52 | .octicon-checklist:before { content: '\f076'} /*  */ 53 | .octicon-chevron-down:before { content: '\f0a3'} /*  */ 54 | .octicon-chevron-left:before { content: '\f0a4'} /*  */ 55 | .octicon-chevron-right:before { content: '\f078'} /*  */ 56 | .octicon-chevron-up:before { content: '\f0a2'} /*  */ 57 | .octicon-circle-slash:before { content: '\f084'} /*  */ 58 | .octicon-circuit-board:before { content: '\f0d6'} /*  */ 59 | .octicon-clippy:before { content: '\f035'} /*  */ 60 | .octicon-clock:before { content: '\f046'} /*  */ 61 | .octicon-cloud-download:before { content: '\f00b'} /*  */ 62 | .octicon-cloud-upload:before { content: '\f00c'} /*  */ 63 | .octicon-code:before { content: '\f05f'} /*  */ 64 | .octicon-comment-add:before, 65 | .octicon-comment:before { content: '\f02b'} /*  */ 66 | .octicon-comment-discussion:before { content: '\f04f'} /*  */ 67 | .octicon-credit-card:before { content: '\f045'} /*  */ 68 | .octicon-dash:before { content: '\f0ca'} /*  */ 69 | .octicon-dashboard:before { content: '\f07d'} /*  */ 70 | .octicon-database:before { content: '\f096'} /*  */ 71 | .octicon-clone:before, 72 | .octicon-desktop-download:before { content: '\f0dc'} /*  */ 73 | .octicon-device-camera:before { content: '\f056'} /*  */ 74 | .octicon-device-camera-video:before { content: '\f057'} /*  */ 75 | .octicon-device-desktop:before { content: '\f27c'} /*  */ 76 | .octicon-device-mobile:before { content: '\f038'} /*  */ 77 | .octicon-diff:before { content: '\f04d'} /*  */ 78 | .octicon-diff-added:before { content: '\f06b'} /*  */ 79 | .octicon-diff-ignored:before { content: '\f099'} /*  */ 80 | .octicon-diff-modified:before { content: '\f06d'} /*  */ 81 | .octicon-diff-removed:before { content: '\f06c'} /*  */ 82 | .octicon-diff-renamed:before { content: '\f06e'} /*  */ 83 | .octicon-ellipsis:before { content: '\f09a'} /*  */ 84 | .octicon-eye-unwatch:before, 85 | .octicon-eye-watch:before, 86 | .octicon-eye:before { content: '\f04e'} /*  */ 87 | .octicon-file-binary:before { content: '\f094'} /*  */ 88 | .octicon-file-code:before { content: '\f010'} /*  */ 89 | .octicon-file-directory:before { content: '\f016'} /*  */ 90 | .octicon-file-media:before { content: '\f012'} /*  */ 91 | .octicon-file-pdf:before { content: '\f014'} /*  */ 92 | .octicon-file-submodule:before { content: '\f017'} /*  */ 93 | .octicon-file-symlink-directory:before { content: '\f0b1'} /*  */ 94 | .octicon-file-symlink-file:before { content: '\f0b0'} /*  */ 95 | .octicon-file-text:before { content: '\f011'} /*  */ 96 | .octicon-file-zip:before { content: '\f013'} /*  */ 97 | .octicon-flame:before { content: '\f0d2'} /*  */ 98 | .octicon-fold:before { content: '\f0cc'} /*  */ 99 | .octicon-gear:before { content: '\f02f'} /*  */ 100 | .octicon-gift:before { content: '\f042'} /*  */ 101 | .octicon-gist:before { content: '\f00e'} /*  */ 102 | .octicon-gist-secret:before { content: '\f08c'} /*  */ 103 | .octicon-git-branch-create:before, 104 | .octicon-git-branch-delete:before, 105 | .octicon-git-branch:before { content: '\f020'} /*  */ 106 | .octicon-git-commit:before { content: '\f01f'} /*  */ 107 | .octicon-git-compare:before { content: '\f0ac'} /*  */ 108 | .octicon-git-merge:before { content: '\f023'} /*  */ 109 | .octicon-git-pull-request-abandoned:before, 110 | .octicon-git-pull-request:before { content: '\f009'} /*  */ 111 | .octicon-globe:before { content: '\f0b6'} /*  */ 112 | .octicon-graph:before { content: '\f043'} /*  */ 113 | .octicon-heart:before { content: '\2665'} /* ♥ */ 114 | .octicon-history:before { content: '\f07e'} /*  */ 115 | .octicon-home:before { content: '\f08d'} /*  */ 116 | .octicon-horizontal-rule:before { content: '\f070'} /*  */ 117 | .octicon-hubot:before { content: '\f09d'} /*  */ 118 | .octicon-inbox:before { content: '\f0cf'} /*  */ 119 | .octicon-info:before { content: '\f059'} /*  */ 120 | .octicon-issue-closed:before { content: '\f028'} /*  */ 121 | .octicon-issue-opened:before { content: '\f026'} /*  */ 122 | .octicon-issue-reopened:before { content: '\f027'} /*  */ 123 | .octicon-italic:before { content: '\f0e4'} /*  */ 124 | .octicon-jersey:before { content: '\f019'} /*  */ 125 | .octicon-key:before { content: '\f049'} /*  */ 126 | .octicon-keyboard:before { content: '\f00d'} /*  */ 127 | .octicon-law:before { content: '\f0d8'} /*  */ 128 | .octicon-light-bulb:before { content: '\f000'} /*  */ 129 | .octicon-link:before { content: '\f05c'} /*  */ 130 | .octicon-link-external:before { content: '\f07f'} /*  */ 131 | .octicon-list-ordered:before { content: '\f062'} /*  */ 132 | .octicon-list-unordered:before { content: '\f061'} /*  */ 133 | .octicon-location:before { content: '\f060'} /*  */ 134 | .octicon-gist-private:before, 135 | .octicon-mirror-private:before, 136 | .octicon-git-fork-private:before, 137 | .octicon-lock:before { content: '\f06a'} /*  */ 138 | .octicon-logo-gist:before { content: '\f0ad'} /*  */ 139 | .octicon-logo-github:before { content: '\f092'} /*  */ 140 | .octicon-mail:before { content: '\f03b'} /*  */ 141 | .octicon-mail-read:before { content: '\f03c'} /*  */ 142 | .octicon-mail-reply:before { content: '\f051'} /*  */ 143 | .octicon-mark-github:before { content: '\f00a'} /*  */ 144 | .octicon-markdown:before { content: '\f0c9'} /*  */ 145 | .octicon-megaphone:before { content: '\f077'} /*  */ 146 | .octicon-mention:before { content: '\f0be'} /*  */ 147 | .octicon-milestone:before { content: '\f075'} /*  */ 148 | .octicon-mirror-public:before, 149 | .octicon-mirror:before { content: '\f024'} /*  */ 150 | .octicon-mortar-board:before { content: '\f0d7'} /*  */ 151 | .octicon-mute:before { content: '\f080'} /*  */ 152 | .octicon-no-newline:before { content: '\f09c'} /*  */ 153 | .octicon-octoface:before { content: '\f008'} /*  */ 154 | .octicon-organization:before { content: '\f037'} /*  */ 155 | .octicon-package:before { content: '\f0c4'} /*  */ 156 | .octicon-paintcan:before { content: '\f0d1'} /*  */ 157 | .octicon-pencil:before { content: '\f058'} /*  */ 158 | .octicon-person-add:before, 159 | .octicon-person-follow:before, 160 | .octicon-person:before { content: '\f018'} /*  */ 161 | .octicon-pin:before { content: '\f041'} /*  */ 162 | .octicon-plug:before { content: '\f0d4'} /*  */ 163 | .octicon-repo-create:before, 164 | .octicon-gist-new:before, 165 | .octicon-file-directory-create:before, 166 | .octicon-file-add:before, 167 | .octicon-plus:before { content: '\f05d'} /*  */ 168 | .octicon-primitive-dot:before { content: '\f052'} /*  */ 169 | .octicon-primitive-square:before { content: '\f053'} /*  */ 170 | .octicon-pulse:before { content: '\f085'} /*  */ 171 | .octicon-question:before { content: '\f02c'} /*  */ 172 | .octicon-quote:before { content: '\f063'} /*  */ 173 | .octicon-radio-tower:before { content: '\f030'} /*  */ 174 | .octicon-repo-delete:before, 175 | .octicon-repo:before { content: '\f001'} /*  */ 176 | .octicon-repo-clone:before { content: '\f04c'} /*  */ 177 | .octicon-repo-force-push:before { content: '\f04a'} /*  */ 178 | .octicon-gist-fork:before, 179 | .octicon-repo-forked:before { content: '\f002'} /*  */ 180 | .octicon-repo-pull:before { content: '\f006'} /*  */ 181 | .octicon-repo-push:before { content: '\f005'} /*  */ 182 | .octicon-rocket:before { content: '\f033'} /*  */ 183 | .octicon-rss:before { content: '\f034'} /*  */ 184 | .octicon-ruby:before { content: '\f047'} /*  */ 185 | .octicon-search-save:before, 186 | .octicon-search:before { content: '\f02e'} /*  */ 187 | .octicon-server:before { content: '\f097'} /*  */ 188 | .octicon-settings:before { content: '\f07c'} /*  */ 189 | .octicon-shield:before { content: '\f0e1'} /*  */ 190 | .octicon-log-in:before, 191 | .octicon-sign-in:before { content: '\f036'} /*  */ 192 | .octicon-log-out:before, 193 | .octicon-sign-out:before { content: '\f032'} /*  */ 194 | .octicon-smiley:before { content: '\f0e7'} /*  */ 195 | .octicon-squirrel:before { content: '\f0b2'} /*  */ 196 | .octicon-star-add:before, 197 | .octicon-star-delete:before, 198 | .octicon-star:before { content: '\f02a'} /*  */ 199 | .octicon-stop:before { content: '\f08f'} /*  */ 200 | .octicon-repo-sync:before, 201 | .octicon-sync:before { content: '\f087'} /*  */ 202 | .octicon-tag-remove:before, 203 | .octicon-tag-add:before, 204 | .octicon-tag:before { content: '\f015'} /*  */ 205 | .octicon-tasklist:before { content: '\f0e5'} /*  */ 206 | .octicon-telescope:before { content: '\f088'} /*  */ 207 | .octicon-terminal:before { content: '\f0c8'} /*  */ 208 | .octicon-text-size:before { content: '\f0e3'} /*  */ 209 | .octicon-three-bars:before { content: '\f05e'} /*  */ 210 | .octicon-thumbsdown:before { content: '\f0db'} /*  */ 211 | .octicon-thumbsup:before { content: '\f0da'} /*  */ 212 | .octicon-tools:before { content: '\f031'} /*  */ 213 | .octicon-trashcan:before { content: '\f0d0'} /*  */ 214 | .octicon-triangle-down:before { content: '\f05b'} /*  */ 215 | .octicon-triangle-left:before { content: '\f044'} /*  */ 216 | .octicon-triangle-right:before { content: '\f05a'} /*  */ 217 | .octicon-triangle-up:before { content: '\f0aa'} /*  */ 218 | .octicon-unfold:before { content: '\f039'} /*  */ 219 | .octicon-unmute:before { content: '\f0ba'} /*  */ 220 | .octicon-unverified:before { content: '\f0e8'} /*  */ 221 | .octicon-verified:before { content: '\f0e6'} /*  */ 222 | .octicon-versions:before { content: '\f064'} /*  */ 223 | .octicon-watch:before { content: '\f0e0'} /*  */ 224 | .octicon-remove-close:before, 225 | .octicon-x:before { content: '\f081'} /*  */ 226 | .octicon-zap:before { content: '\26A1'} /* ⚡ */ 227 | -------------------------------------------------------------------------------- /demo/octicons/octicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/demo/octicons/octicons.eot -------------------------------------------------------------------------------- /demo/octicons/octicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/demo/octicons/octicons.ttf -------------------------------------------------------------------------------- /demo/octicons/octicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathantneal/mdcss-theme-github/c3d5aa036f06d6ef05cba4e79dab3b83ccd263d7/demo/octicons/octicons.woff -------------------------------------------------------------------------------- /demo/prism.js: -------------------------------------------------------------------------------- 1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+bash+markdown+php+scss+wiki */ 2 | var _self = (typeof window !== 'undefined') 3 | ? window // if in browser 4 | : ( 5 | (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) 6 | ? self // if in worker 7 | : {} // if in node js 8 | ); 9 | 10 | /** 11 | * Prism: Lightweight, robust, elegant syntax highlighting 12 | * MIT license http://www.opensource.org/licenses/mit-license.php/ 13 | * @author Lea Verou http://lea.verou.me 14 | */ 15 | 16 | var Prism = (function(){ 17 | 18 | // Private helper vars 19 | var lang = /\blang(?:uage)?-(?!\*)(\w+)\b/i; 20 | 21 | var _ = _self.Prism = { 22 | util: { 23 | encode: function (tokens) { 24 | if (tokens instanceof Token) { 25 | return new Token(tokens.type, _.util.encode(tokens.content), tokens.alias); 26 | } else if (_.util.type(tokens) === 'Array') { 27 | return tokens.map(_.util.encode); 28 | } else { 29 | return tokens.replace(/&/g, '&').replace(/ text.length) { 270 | // Something went terribly wrong, ABORT, ABORT! 271 | break tokenloop; 272 | } 273 | 274 | if (str instanceof Token) { 275 | continue; 276 | } 277 | 278 | pattern.lastIndex = 0; 279 | 280 | var match = pattern.exec(str); 281 | 282 | if (match) { 283 | if(lookbehind) { 284 | lookbehindLength = match[1].length; 285 | } 286 | 287 | var from = match.index - 1 + lookbehindLength, 288 | match = match[0].slice(lookbehindLength), 289 | len = match.length, 290 | to = from + len, 291 | before = str.slice(0, from + 1), 292 | after = str.slice(to + 1); 293 | 294 | var args = [i, 1]; 295 | 296 | if (before) { 297 | args.push(before); 298 | } 299 | 300 | var wrapped = new Token(token, inside? _.tokenize(match, inside) : match, alias); 301 | 302 | args.push(wrapped); 303 | 304 | if (after) { 305 | args.push(after); 306 | } 307 | 308 | Array.prototype.splice.apply(strarr, args); 309 | } 310 | } 311 | } 312 | } 313 | 314 | return strarr; 315 | }, 316 | 317 | hooks: { 318 | all: {}, 319 | 320 | add: function (name, callback) { 321 | var hooks = _.hooks.all; 322 | 323 | hooks[name] = hooks[name] || []; 324 | 325 | hooks[name].push(callback); 326 | }, 327 | 328 | run: function (name, env) { 329 | var callbacks = _.hooks.all[name]; 330 | 331 | if (!callbacks || !callbacks.length) { 332 | return; 333 | } 334 | 335 | for (var i=0, callback; callback = callbacks[i++];) { 336 | callback(env); 337 | } 338 | } 339 | } 340 | }; 341 | 342 | var Token = _.Token = function(type, content, alias) { 343 | this.type = type; 344 | this.content = content; 345 | this.alias = alias; 346 | }; 347 | 348 | Token.stringify = function(o, language, parent) { 349 | if (typeof o == 'string') { 350 | return o; 351 | } 352 | 353 | if (_.util.type(o) === 'Array') { 354 | return o.map(function(element) { 355 | return Token.stringify(element, language, o); 356 | }).join(''); 357 | } 358 | 359 | var env = { 360 | type: o.type, 361 | content: Token.stringify(o.content, language, parent), 362 | tag: 'span', 363 | classes: ['token', o.type], 364 | attributes: {}, 365 | language: language, 366 | parent: parent 367 | }; 368 | 369 | if (env.type == 'comment') { 370 | env.attributes['spellcheck'] = 'true'; 371 | } 372 | 373 | if (o.alias) { 374 | var aliases = _.util.type(o.alias) === 'Array' ? o.alias : [o.alias]; 375 | Array.prototype.push.apply(env.classes, aliases); 376 | } 377 | 378 | _.hooks.run('wrap', env); 379 | 380 | var attributes = ''; 381 | 382 | for (var name in env.attributes) { 383 | attributes += (attributes ? ' ' : '') + name + '="' + (env.attributes[name] || '') + '"'; 384 | } 385 | 386 | return '<' + env.tag + ' class="' + env.classes.join(' ') + '" ' + attributes + '>' + env.content + ''; 387 | 388 | }; 389 | 390 | if (!_self.document) { 391 | if (!_self.addEventListener) { 392 | // in Node.js 393 | return _self.Prism; 394 | } 395 | // In worker 396 | _self.addEventListener('message', function(evt) { 397 | var message = JSON.parse(evt.data), 398 | lang = message.language, 399 | code = message.code, 400 | immediateClose = message.immediateClose; 401 | 402 | _self.postMessage(_.highlight(code, _.languages[lang], lang)); 403 | if (immediateClose) { 404 | _self.close(); 405 | } 406 | }, false); 407 | 408 | return _self.Prism; 409 | } 410 | 411 | return _self.Prism; 412 | 413 | })(); 414 | 415 | if (typeof module !== 'undefined' && module.exports) { 416 | module.exports = Prism; 417 | } 418 | 419 | // hack for components to work correctly in node.js 420 | if (typeof global !== 'undefined') { 421 | global.Prism = Prism; 422 | } 423 | ; 424 | Prism.languages.markup = { 425 | 'comment': //, 426 | 'prolog': /<\?[\w\W]+?\?>/, 427 | 'doctype': //, 428 | 'cdata': //i, 429 | 'tag': { 430 | pattern: /<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i, 431 | inside: { 432 | 'tag': { 433 | pattern: /^<\/?[^\s>\/]+/i, 434 | inside: { 435 | 'punctuation': /^<\/?/, 436 | 'namespace': /^[^\s>\/:]+:/ 437 | } 438 | }, 439 | 'attr-value': { 440 | pattern: /=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i, 441 | inside: { 442 | 'punctuation': /[=>"']/ 443 | } 444 | }, 445 | 'punctuation': /\/?>/, 446 | 'attr-name': { 447 | pattern: /[^\s>\/]+/, 448 | inside: { 449 | 'namespace': /^[^\s>\/:]+:/ 450 | } 451 | } 452 | 453 | } 454 | }, 455 | 'entity': /&#?[\da-z]{1,8};/i 456 | }; 457 | 458 | // Plugin to make entity title show the real entity, idea by Roman Komarov 459 | Prism.hooks.add('wrap', function(env) { 460 | 461 | if (env.type === 'entity') { 462 | env.attributes['title'] = env.content.replace(/&/, '&'); 463 | } 464 | }); 465 | 466 | Prism.languages.xml = Prism.languages.markup; 467 | Prism.languages.html = Prism.languages.markup; 468 | Prism.languages.mathml = Prism.languages.markup; 469 | Prism.languages.svg = Prism.languages.markup; 470 | 471 | Prism.languages.css = { 472 | 'comment': /\/\*[\w\W]*?\*\//, 473 | 'atrule': { 474 | pattern: /@[\w-]+?.*?(;|(?=\s*\{))/i, 475 | inside: { 476 | 'rule': /@[\w-]+/ 477 | // See rest below 478 | } 479 | }, 480 | 'url': /url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i, 481 | 'selector': /[^\{\}\s][^\{\};]*?(?=\s*\{)/, 482 | 'string': /("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/, 483 | 'property': /(\b|\B)[\w-]+(?=\s*:)/i, 484 | 'important': /\B!important\b/i, 485 | 'function': /[-a-z0-9]+(?=\()/i, 486 | 'punctuation': /[(){};:]/ 487 | }; 488 | 489 | Prism.languages.css['atrule'].inside.rest = Prism.util.clone(Prism.languages.css); 490 | 491 | if (Prism.languages.markup) { 492 | Prism.languages.insertBefore('markup', 'tag', { 493 | 'style': { 494 | pattern: /()[\w\W]*?(?=<\/style>)/i, 495 | lookbehind: true, 496 | inside: Prism.languages.css, 497 | alias: 'language-css' 498 | } 499 | }); 500 | 501 | Prism.languages.insertBefore('inside', 'attr-value', { 502 | 'style-attr': { 503 | pattern: /\s*style=("|').*?\1/i, 504 | inside: { 505 | 'attr-name': { 506 | pattern: /^\s*style/i, 507 | inside: Prism.languages.markup.tag.inside 508 | }, 509 | 'punctuation': /^\s*=\s*['"]|['"]\s*$/, 510 | 'attr-value': { 511 | pattern: /.+/i, 512 | inside: Prism.languages.css 513 | } 514 | }, 515 | alias: 'language-css' 516 | } 517 | }, Prism.languages.markup.tag); 518 | }; 519 | Prism.languages.clike = { 520 | 'comment': [ 521 | { 522 | pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, 523 | lookbehind: true 524 | }, 525 | { 526 | pattern: /(^|[^\\:])\/\/.*/, 527 | lookbehind: true 528 | } 529 | ], 530 | 'string': /(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, 531 | 'class-name': { 532 | pattern: /((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i, 533 | lookbehind: true, 534 | inside: { 535 | punctuation: /(\.|\\)/ 536 | } 537 | }, 538 | 'keyword': /\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/, 539 | 'boolean': /\b(true|false)\b/, 540 | 'function': /[a-z0-9_]+(?=\()/i, 541 | 'number': /\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i, 542 | 'operator': /--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/, 543 | 'punctuation': /[{}[\];(),.:]/ 544 | }; 545 | 546 | Prism.languages.javascript = Prism.languages.extend('clike', { 547 | 'keyword': /\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/, 548 | 'number': /\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/, 549 | // Allow for all non-ASCII characters (See http://stackoverflow.com/a/2008444) 550 | 'function': /[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i 551 | }); 552 | 553 | Prism.languages.insertBefore('javascript', 'keyword', { 554 | 'regex': { 555 | pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/, 556 | lookbehind: true 557 | } 558 | }); 559 | 560 | Prism.languages.insertBefore('javascript', 'class-name', { 561 | 'template-string': { 562 | pattern: /`(?:\\`|\\?[^`])*`/, 563 | inside: { 564 | 'interpolation': { 565 | pattern: /\$\{[^}]+\}/, 566 | inside: { 567 | 'interpolation-punctuation': { 568 | pattern: /^\$\{|\}$/, 569 | alias: 'punctuation' 570 | }, 571 | rest: Prism.languages.javascript 572 | } 573 | }, 574 | 'string': /[\s\S]+/ 575 | } 576 | } 577 | }); 578 | 579 | if (Prism.languages.markup) { 580 | Prism.languages.insertBefore('markup', 'tag', { 581 | 'script': { 582 | pattern: /()[\w\W]*?(?=<\/script>)/i, 583 | lookbehind: true, 584 | inside: Prism.languages.javascript, 585 | alias: 'language-javascript' 586 | } 587 | }); 588 | } 589 | 590 | Prism.languages.js = Prism.languages.javascript; 591 | (function(Prism) { 592 | var insideString = { 593 | variable: [ 594 | // Arithmetic Environment 595 | { 596 | pattern: /\$?\(\([\w\W]+?\)\)/, 597 | inside: { 598 | // If there is a $ sign at the beginning highlight $(( and )) as variable 599 | variable: [{ 600 | pattern: /(^\$\(\([\w\W]+)\)\)/, 601 | lookbehind: true 602 | }, 603 | /^\$\(\(/, 604 | ], 605 | number: /\b-?(?:0x[\dA-Fa-f]+|\d*\.?\d+(?:[Ee]-?\d+)?)\b/, 606 | // Operators according to https://www.gnu.org/software/bash/manual/bashref.html#Shell-Arithmetic 607 | operator: /--?|-=|\+\+?|\+=|!=?|~|\*\*?|\*=|\/=?|%=?|<<=?|>>=?|<=?|>=?|==?|&&?|&=|\^=?|\|\|?|\|=|\?|:/, 608 | // If there is no $ sign at the beginning highlight (( and )) as punctuation 609 | punctuation: /\(\(?|\)\)?|,|;/ 610 | } 611 | }, 612 | // Command Substitution 613 | { 614 | pattern: /\$\([^)]+\)|`[^`]+`/, 615 | inside: { 616 | variable: /^\$\(|^`|\)$|`$/ 617 | } 618 | }, 619 | /\$(?:[a-z0-9_#\?\*!@]+|\{[^}]+\})/i 620 | ], 621 | }; 622 | 623 | Prism.languages.bash = { 624 | 'shebang': { 625 | pattern: /^#!\s*\/bin\/bash|^#!\s*\/bin\/sh/, 626 | alias: 'important' 627 | }, 628 | 'comment': { 629 | pattern: /(^|[^"{\\])#.*/, 630 | lookbehind: true 631 | }, 632 | 'string': [ 633 | //Support for Here-Documents https://en.wikipedia.org/wiki/Here_document 634 | { 635 | pattern: /((?:^|[^<])<<\s*)(?:"|')?(\w+?)(?:"|')?\s*\r?\n(?:[\s\S])*?\r?\n\2/g, 636 | lookbehind: true, 637 | inside: insideString 638 | }, 639 | { 640 | pattern: /("|')(?:\\?[\s\S])*?\1/g, 641 | inside: insideString 642 | } 643 | ], 644 | 'variable': insideString.variable, 645 | // Originally based on http://ss64.com/bash/ 646 | 'function': { 647 | pattern: /(^|\s|;|\||&)(?:alias|apropos|apt-get|aptitude|aspell|awk|basename|bash|bc|bg|builtin|bzip2|cal|cat|cd|cfdisk|chgrp|chmod|chown|chroot|chkconfig|cksum|clear|cmp|comm|command|cp|cron|crontab|csplit|cut|date|dc|dd|ddrescue|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|du|egrep|eject|enable|env|ethtool|eval|exec|expand|expect|export|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|getopts|git|grep|groupadd|groupdel|groupmod|groups|gzip|hash|head|help|hg|history|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|jobs|join|kill|killall|less|link|ln|locate|logname|logout|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|make|man|mkdir|mkfifo|mkisofs|mknod|more|most|mount|mtools|mtr|mv|mmv|nano|netstat|nice|nl|nohup|notify-send|nslookup|open|op|passwd|paste|pathchk|ping|pkill|popd|pr|printcap|printenv|printf|ps|pushd|pv|pwd|quota|quotacheck|quotactl|ram|rar|rcp|read|readarray|readonly|reboot|rename|renice|remsync|rev|rm|rmdir|rsync|screen|scp|sdiff|sed|seq|service|sftp|shift|shopt|shutdown|sleep|slocate|sort|source|split|ssh|stat|strace|su|sudo|sum|suspend|sync|tail|tar|tee|test|time|timeout|times|touch|top|traceroute|trap|tr|tsort|tty|type|ulimit|umask|umount|unalias|uname|unexpand|uniq|units|unrar|unshar|uptime|useradd|userdel|usermod|users|uuencode|uudecode|v|vdir|vi|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yes|zip)(?=$|\s|;|\||&)/, 648 | lookbehind: true 649 | }, 650 | 'keyword': { 651 | pattern: /(^|\s|;|\||&)(?:let|:|\.|if|then|else|elif|fi|for|break|continue|while|in|case|function|select|do|done|until|echo|exit|return|set|declare)(?=$|\s|;|\||&)/, 652 | lookbehind: true 653 | }, 654 | 'boolean': { 655 | pattern: /(^|\s|;|\||&)(?:true|false)(?=$|\s|;|\||&)/, 656 | lookbehind: true 657 | }, 658 | 'operator': /&&?|\|\|?|==?|!=?|<<>|<=?|>=?|=~/, 659 | 'punctuation': /\$?\(\(?|\)\)?|\.\.|[{}[\];]/ 660 | }; 661 | 662 | var inside = insideString.variable[1].inside; 663 | inside['function'] = Prism.languages.bash['function']; 664 | inside.keyword = Prism.languages.bash.keyword; 665 | inside.boolean = Prism.languages.bash.boolean; 666 | inside.operator = Prism.languages.bash.operator; 667 | inside.punctuation = Prism.languages.bash.punctuation; 668 | })(Prism); 669 | Prism.languages.markdown = Prism.languages.extend('markup', {}); 670 | Prism.languages.insertBefore('markdown', 'prolog', { 671 | 'blockquote': { 672 | // > ... 673 | pattern: /^>(?:[\t ]*>)*/m, 674 | alias: 'punctuation' 675 | }, 676 | 'code': [ 677 | { 678 | // Prefixed by 4 spaces or 1 tab 679 | pattern: /^(?: {4}|\t).+/m, 680 | alias: 'keyword' 681 | }, 682 | { 683 | // `code` 684 | // ``code`` 685 | pattern: /``.+?``|`[^`\n]+`/, 686 | alias: 'keyword' 687 | } 688 | ], 689 | 'title': [ 690 | { 691 | // title 1 692 | // ======= 693 | 694 | // title 2 695 | // ------- 696 | pattern: /\w+.*(?:\r?\n|\r)(?:==+|--+)/, 697 | alias: 'important', 698 | inside: { 699 | punctuation: /==+$|--+$/ 700 | } 701 | }, 702 | { 703 | // # title 1 704 | // ###### title 6 705 | pattern: /(^\s*)#+.+/m, 706 | lookbehind: true, 707 | alias: 'important', 708 | inside: { 709 | punctuation: /^#+|#+$/ 710 | } 711 | } 712 | ], 713 | 'hr': { 714 | // *** 715 | // --- 716 | // * * * 717 | // ----------- 718 | pattern: /(^\s*)([*-])([\t ]*\2){2,}(?=\s*$)/m, 719 | lookbehind: true, 720 | alias: 'punctuation' 721 | }, 722 | 'list': { 723 | // * item 724 | // + item 725 | // - item 726 | // 1. item 727 | pattern: /(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m, 728 | lookbehind: true, 729 | alias: 'punctuation' 730 | }, 731 | 'url-reference': { 732 | // [id]: http://example.com "Optional title" 733 | // [id]: http://example.com 'Optional title' 734 | // [id]: http://example.com (Optional title) 735 | // [id]: "Optional title" 736 | pattern: /!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/, 737 | inside: { 738 | 'variable': { 739 | pattern: /^(!?\[)[^\]]+/, 740 | lookbehind: true 741 | }, 742 | 'string': /(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/, 743 | 'punctuation': /^[\[\]!:]|[<>]/ 744 | }, 745 | alias: 'url' 746 | }, 747 | 'bold': { 748 | // **strong** 749 | // __strong__ 750 | 751 | // Allow only one line break 752 | pattern: /(^|[^\\])(\*\*|__)(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/, 753 | lookbehind: true, 754 | inside: { 755 | 'punctuation': /^\*\*|^__|\*\*$|__$/ 756 | } 757 | }, 758 | 'italic': { 759 | // *em* 760 | // _em_ 761 | 762 | // Allow only one line break 763 | pattern: /(^|[^\\])([*_])(?:(?:\r?\n|\r)(?!\r?\n|\r)|.)+?\2/, 764 | lookbehind: true, 765 | inside: { 766 | 'punctuation': /^[*_]|[*_]$/ 767 | } 768 | }, 769 | 'url': { 770 | // [example](http://example.com "Optional title") 771 | // [example] [id] 772 | pattern: /!?\[[^\]]+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)| ?\[[^\]\n]*\])/, 773 | inside: { 774 | 'variable': { 775 | pattern: /(!?\[)[^\]]+(?=\]$)/, 776 | lookbehind: true 777 | }, 778 | 'string': { 779 | pattern: /"(?:\\.|[^"\\])*"(?=\)$)/ 780 | } 781 | } 782 | } 783 | }); 784 | 785 | Prism.languages.markdown['bold'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']); 786 | Prism.languages.markdown['italic'].inside['url'] = Prism.util.clone(Prism.languages.markdown['url']); 787 | Prism.languages.markdown['bold'].inside['italic'] = Prism.util.clone(Prism.languages.markdown['italic']); 788 | Prism.languages.markdown['italic'].inside['bold'] = Prism.util.clone(Prism.languages.markdown['bold']); 789 | /** 790 | * Original by Aaron Harun: http://aahacreative.com/2012/07/31/php-syntax-highlighting-prism/ 791 | * Modified by Miles Johnson: http://milesj.me 792 | * 793 | * Supports the following: 794 | * - Extends clike syntax 795 | * - Support for PHP 5.3+ (namespaces, traits, generators, etc) 796 | * - Smarter constant and function matching 797 | * 798 | * Adds the following new token classes: 799 | * constant, delimiter, variable, function, package 800 | */ 801 | 802 | Prism.languages.php = Prism.languages.extend('clike', { 803 | 'keyword': /\b(and|or|xor|array|as|break|case|cfunction|class|const|continue|declare|default|die|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|for|foreach|function|include|include_once|global|if|new|return|static|switch|use|require|require_once|var|while|abstract|interface|public|implements|private|protected|parent|throw|null|echo|print|trait|namespace|final|yield|goto|instanceof|finally|try|catch)\b/i, 804 | 'constant': /\b[A-Z0-9_]{2,}\b/, 805 | 'comment': { 806 | pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/, 807 | lookbehind: true 808 | } 809 | }); 810 | 811 | // Shell-like comments are matched after strings, because they are less 812 | // common than strings containing hashes... 813 | Prism.languages.insertBefore('php', 'class-name', { 814 | 'shell-comment': { 815 | pattern: /(^|[^\\])#.*/, 816 | lookbehind: true, 817 | alias: 'comment' 818 | } 819 | }); 820 | 821 | Prism.languages.insertBefore('php', 'keyword', { 822 | 'delimiter': /\?>|<\?(?:php)?/i, 823 | 'variable': /\$\w+\b/i, 824 | 'package': { 825 | pattern: /(\\|namespace\s+|use\s+)[\w\\]+/, 826 | lookbehind: true, 827 | inside: { 828 | punctuation: /\\/ 829 | } 830 | } 831 | }); 832 | 833 | // Must be defined after the function pattern 834 | Prism.languages.insertBefore('php', 'operator', { 835 | 'property': { 836 | pattern: /(->)[\w]+/, 837 | lookbehind: true 838 | } 839 | }); 840 | 841 | // Add HTML support of the markup language exists 842 | if (Prism.languages.markup) { 843 | 844 | // Tokenize all inline PHP blocks that are wrapped in 845 | // This allows for easy PHP + markup highlighting 846 | Prism.hooks.add('before-highlight', function(env) { 847 | if (env.language !== 'php') { 848 | return; 849 | } 850 | 851 | env.tokenStack = []; 852 | 853 | env.backupCode = env.code; 854 | env.code = env.code.replace(/(?:<\?php|<\?)[\w\W]*?(?:\?>)/ig, function(match) { 855 | env.tokenStack.push(match); 856 | 857 | return '{{{PHP' + env.tokenStack.length + '}}}'; 858 | }); 859 | }); 860 | 861 | // Restore env.code for other plugins (e.g. line-numbers) 862 | Prism.hooks.add('before-insert', function(env) { 863 | if (env.language === 'php') { 864 | env.code = env.backupCode; 865 | delete env.backupCode; 866 | } 867 | }); 868 | 869 | // Re-insert the tokens after highlighting 870 | Prism.hooks.add('after-highlight', function(env) { 871 | if (env.language !== 'php') { 872 | return; 873 | } 874 | 875 | for (var i = 0, t; t = env.tokenStack[i]; i++) { 876 | // The replace prevents $$, $&, $`, $', $n, $nn from being interpreted as special patterns 877 | env.highlightedCode = env.highlightedCode.replace('{{{PHP' + (i + 1) + '}}}', Prism.highlight(t, env.grammar, 'php').replace(/\$/g, '$$$$')); 878 | } 879 | 880 | env.element.innerHTML = env.highlightedCode; 881 | }); 882 | 883 | // Wrap tokens in classes that are missing them 884 | Prism.hooks.add('wrap', function(env) { 885 | if (env.language === 'php' && env.type === 'markup') { 886 | env.content = env.content.replace(/(\{\{\{PHP[0-9]+\}\}\})/g, "$1"); 887 | } 888 | }); 889 | 890 | // Add the rules before all others 891 | Prism.languages.insertBefore('php', 'comment', { 892 | 'markup': { 893 | pattern: /<[^?]\/?(.*?)>/, 894 | inside: Prism.languages.markup 895 | }, 896 | 'php': /\{\{\{PHP[0-9]+\}\}\}/ 897 | }); 898 | } 899 | ; 900 | Prism.languages.scss = Prism.languages.extend('css', { 901 | 'comment': { 902 | pattern: /(^|[^\\])(?:\/\*[\w\W]*?\*\/|\/\/.*)/, 903 | lookbehind: true 904 | }, 905 | 'atrule': { 906 | pattern: /@[\w-]+(?:\([^()]+\)|[^(])*?(?=\s+[{;])/, 907 | inside: { 908 | 'rule': /@[\w-]+/ 909 | // See rest below 910 | } 911 | }, 912 | // url, compassified 913 | 'url': /(?:[-a-z]+-)*url(?=\()/i, 914 | // CSS selector regex is not appropriate for Sass 915 | // since there can be lot more things (var, @ directive, nesting..) 916 | // a selector must start at the end of a property or after a brace (end of other rules or nesting) 917 | // it can contain some characters that aren't used for defining rules or end of selector, & (parent selector), or interpolated variable 918 | // the end of a selector is found when there is no rules in it ( {} or {\s}) or if there is a property (because an interpolated var 919 | // can "pass" as a selector- e.g: proper#{$erty}) 920 | // this one was hard to do, so please be careful if you edit this one :) 921 | 'selector': { 922 | // Initial look-ahead is used to prevent matching of blank selectors 923 | pattern: /(?=\S)[^@;\{\}\(\)]?([^@;\{\}\(\)]|&|#\{\$[-_\w]+\})+(?=\s*\{(\}|\s|[^\}]+(:|\{)[^\}]+))/m, 924 | inside: { 925 | 'placeholder': /%[-_\w]+/ 926 | } 927 | } 928 | }); 929 | 930 | Prism.languages.insertBefore('scss', 'atrule', { 931 | 'keyword': [ 932 | /@(?:if|else(?: if)?|for|each|while|import|extend|debug|warn|mixin|include|function|return|content)/i, 933 | { 934 | pattern: /( +)(?:from|through)(?= )/, 935 | lookbehind: true 936 | } 937 | ] 938 | }); 939 | 940 | Prism.languages.insertBefore('scss', 'property', { 941 | // var and interpolated vars 942 | 'variable': /\$[-_\w]+|#\{\$[-_\w]+\}/ 943 | }); 944 | 945 | Prism.languages.insertBefore('scss', 'function', { 946 | 'placeholder': { 947 | pattern: /%[-_\w]+/, 948 | alias: 'selector' 949 | }, 950 | 'statement': /\B!(?:default|optional)\b/i, 951 | 'boolean': /\b(?:true|false)\b/, 952 | 'null': /\bnull\b/, 953 | 'operator': { 954 | pattern: /(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|or|not)(?=\s)/, 955 | lookbehind: true 956 | } 957 | }); 958 | 959 | Prism.languages.scss['atrule'].inside.rest = Prism.util.clone(Prism.languages.scss); 960 | Prism.languages.wiki = Prism.languages.extend('markup', { 961 | 'block-comment': { 962 | pattern: /(^|[^\\])\/\*[\w\W]*?\*\//, 963 | lookbehind: true, 964 | alias: 'comment' 965 | }, 966 | 'heading': { 967 | pattern: /^(=+).+?\1/m, 968 | inside: { 969 | 'punctuation': /^=+|=+$/, 970 | 'important': /.+/ 971 | } 972 | }, 973 | 'emphasis': { 974 | // TODO Multi-line 975 | pattern: /('{2,5}).+?\1/, 976 | inside: { 977 | 'bold italic': { 978 | pattern: /(''''').+?(?=\1)/, 979 | lookbehind: true 980 | }, 981 | 'bold': { 982 | pattern: /(''')[^'](?:.*?[^'])?(?=\1)/, 983 | lookbehind: true 984 | }, 985 | 'italic': { 986 | pattern: /('')[^'](?:.*?[^'])?(?=\1)/, 987 | lookbehind: true 988 | }, 989 | 'punctuation': /^''+|''+$/ 990 | } 991 | }, 992 | 'hr': { 993 | pattern: /^-{4,}/m, 994 | alias: 'punctuation' 995 | }, 996 | 'url': [ 997 | /ISBN +(?:97[89][ -]?)?(?:\d[ -]?){9}[\dx]\b|(?:RFC|PMID) +\d+/i, 998 | /\[\[.+?\]\]|\[.+?\]/ 999 | ], 1000 | 'variable': [ 1001 | /__[A-Z]+__/, 1002 | // FIXME Nested structures should be handled 1003 | // {{formatnum:{{#expr:{{{3}}}}}}} 1004 | /\{{3}.+?\}{3}/, 1005 | /\{\{.+?}}/ 1006 | ], 1007 | 'symbol': [ 1008 | /^#redirect/im, 1009 | /~{3,5}/ 1010 | ], 1011 | // Handle table attrs: 1012 | // {| 1013 | // ! style="text-align:left;"| Item 1014 | // |} 1015 | 'table-tag': { 1016 | pattern: /((?:^|[|!])[|!])[^|\r\n]+\|(?!\|)/m, 1017 | lookbehind: true, 1018 | inside: { 1019 | 'table-bar': { 1020 | pattern: /\|$/, 1021 | alias: 'punctuation' 1022 | }, 1023 | rest: Prism.languages.markup['tag'].inside 1024 | } 1025 | }, 1026 | 'punctuation': /^(?:\{\||\|\}|\|-|[*#:;!|])|\|\||!!/m 1027 | }); 1028 | 1029 | Prism.languages.insertBefore('wiki', 'tag', { 1030 | // Prevent highlighting inside , and
 tags
1031 | 	'nowiki': {
1032 | 		pattern: /<(nowiki|pre|source)\b[\w\W]*?>[\w\W]*?<\/\1>/i,
1033 | 		inside: {
1034 | 			'tag': {
1035 | 				pattern: /<(?:nowiki|pre|source)\b[\w\W]*?>|<\/(?:nowiki|pre|source)>/i,
1036 | 				inside: Prism.languages.markup['tag'].inside
1037 | 			}
1038 | 		}
1039 | 	}
1040 | });
1041 | 


--------------------------------------------------------------------------------
/demo/script.js:
--------------------------------------------------------------------------------
 1 | /* eslint-env browser */
 2 | /* global examples, Prism */
 3 | 
 4 | document.addEventListener('DOMContentLoaded', function () {
 5 | 	Array.prototype.forEach.call(document.querySelectorAll('pre code[class^="lang"]'), function (code) {
 6 | 		// set pre, wrap, opts, and get meta data from code
 7 | 		var pre  = code.parentNode;
 8 | 		var conf = {};
 9 | 		var text = String(code.textContent || code.innerText || '');
10 | 
11 | 		// get meta data from code class
12 | 		code.className.replace(/^lang-(\w+)(?::(\w+))?/, function ($0, $1, $2) {
13 | 			if ($2) return 'example:' + $2 + ',lang:' + $2;
14 | 
15 | 			if ($1 === 'example') return 'example:html';
16 | 
17 | 			return 'lang:' + $1;
18 | 		}).split(/\s*,\s*/).forEach(function (opt) {
19 | 			opt = opt.split(':');
20 | 
21 | 			conf[opt.shift().trim()] = opt.join(':').trim();
22 | 		});
23 | 
24 | 		code.removeAttribute('class');
25 | 
26 | 		// conditionally syntax highlight code
27 | 		if (conf.lang in Prism.languages) code.innerHTML = Prism.highlight(text, Prism.languages[conf.lang]);
28 | 
29 | 		// conditionally create code examples
30 | 		if (conf.example in examples.lang) {
31 | 			examples.lang[conf.example](pre, text, conf);
32 | 		}
33 | 	});
34 | });
35 | 


--------------------------------------------------------------------------------
/demo/style.css:
--------------------------------------------------------------------------------
  1 | .container {
  2 |   max-width: 100%;
  3 |   width: 100%;
  4 | }
  5 | 
  6 | .docs-example {
  7 |   display: flex;
  8 |   align-items: center;
  9 |   margin: 0 auto;
 10 |   justify-content: center;
 11 |   position: relative;
 12 | }
 13 | 
 14 | .docs-iframe {
 15 | }
 16 | 
 17 | .docs-example:hover .docs-iframe {
 18 | }
 19 | 
 20 | .docs-resize {
 21 |   width: 100%;
 22 | }
 23 | 
 24 | .docs-iframe {
 25 |   border: 0;
 26 |   height: auto;
 27 |   width: 100%;
 28 |   /* min-width: 320px; */
 29 |   /* max-width: 100%; */
 30 | }
 31 | 
 32 | /* .c-resize--left, */
 33 | /* .c-resize--right { */
 34 | /*   background-color: green; */
 35 | /*   display: inline-block; */
 36 | /*   width: 5px; */
 37 | /*   height: 20px; */
 38 | /* } */
 39 | 
 40 | .swatch {
 41 |   padding: .25em;
 42 |   margin: 0 .3em .3em 0;
 43 |   word-break: break-all;
 44 |   word-wrap: break-word;
 45 |   overflow: hidden;
 46 | }
 47 | 
 48 | .color-property {
 49 |   font-size: 80%;
 50 | }
 51 | 
 52 | /*---
 53 | section: mdcss GitHub
 54 | ---
 55 | [![NPM Version][npm-img]][npm] [![Build Status][ci-img]][ci]
 56 | [mdcss GitHub] is a theme for [mdcss] based on the documentation styles seen
 57 | across GitHub.
 58 | [ci]:      https://travis-ci.org/jonathantneal/mdcss-theme-github
 59 | [ci-img]:  https://img.shields.io/travis/jonathantneal/mdcss-theme-github.svg
 60 | [mdcss]:   https://github.com/jonathantneal/mdcss
 61 | [npm]:     https://www.npmjs.com/package/mdcss-theme-github
 62 | [npm-img]: https://img.shields.io/npm/v/mdcss-theme-github.svg
 63 | [mdcss GitHub]: https://github.com/jonathantneal/mdcss-theme-github
 64 | */
 65 | 
 66 | /*---
 67 | title:   Usage
 68 | section: mdcss GitHub
 69 | ---
 70 | Add [mdcss] and [mdcss GitHub] to your build tool:
 71 | ```bash
 72 | npm install mdcss mdcss-theme-github --save-dev
 73 | ```
 74 | Whenever [mdcss] is used, reference this theme.
 75 | ```js
 76 | require('mdcss')({
 77 | 	theme: require('mdcss-theme-github')({ /​* options *​/ })
 78 | })
 79 | ```
 80 | [mdcss]:   https://github.com/jonathantneal/mdcss
 81 | [mdcss GitHub]: https://github.com/jonathantneal/mdcss-theme-github
 82 | */
 83 | 
 84 | /*---
 85 | title:  Options
 86 | section: mdcss GitHub
 87 | ---
 88 | Options control the look and feel of the mdcss GitHub theme as well as any
 89 | iframe examples that may be used.
 90 | #### `title`
 91 | Type: `String`  
 92 | Default: `'Style Guide'`
 93 | The page title to be used by the style guide.
 94 | #### `logo`
 95 | Type: `String`  
 96 | Default: `'mdcss-logo.png'`
 97 | 
 98 | 
 99 | 
100 | The page logo to be used by the style guide.
101 | #### `examples.base`
102 | Type:    `String`  
103 | Default: `null`
104 | The base URL to use for all relative URLs contained within an example,
105 | including CSS and JavaScript references.
106 | #### `examples.target`
107 | Type:    `String`  
108 | Default: `'_self'`
109 | The frame to open example hyperlinks from within an example.
110 | #### `examples.css`
111 | Type:    `Array`  
112 | Default: `['style.css']`
113 | A list of CSS files to be used by examples.
114 | #### `examples.js`
115 | Type:    `Array`  
116 | Default: `null`
117 | A list of JavaScript files to be used by examples.
118 | #### `examples.bodyjs`
119 | Type:    `Array`  
120 | Default: `null`
121 | A list of JavaScript files to be used by examples, inserted after the example.
122 | #### `examples.htmlcss`
123 | Type:    `String`  
124 | Default: `'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:0;position:static;width:auto'`
125 | A string of styles applied to the `` wrapping the example. These default
126 | styles are used to create a seamless effect with the styleguide.
127 | #### `examples.bodycss`
128 | Type:    `String`  
129 | Default: `'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:16px;position:static;width:auto'`
130 | A string of styles applied to the `` wrapping the example. These default
131 | styles are used to create a seamless effect with the styleguide.
132 | */
133 | 
134 | /*---
135 | title:   Examples
136 | section: Overview
137 | ---
138 | The `example` keyword is used by code blocks to indicate that code will be
139 | rendered as a living example on the page.
140 | An `example:html` code block
141 | generates an iframe using the contents of the code block, followed by the
142 | original code block. For example:
143 | ````css
144 | ```example:html
145 | 
146 | ```
147 | ````
148 | is rendered as:
149 | ```example:html
150 | 
151 | ```
152 | An `example` code block generates an iframe using the contents of the code
153 | block without also rendering the original code block. For example:
154 | ````css
155 | ```example
156 | 
157 | ```
158 | ````
159 | is rendered as:
160 | ```example
161 | 
162 | ```
163 | */
164 | 
165 | /*---
166 | title:   Colors
167 | section: Overview
168 | ---
169 | Color examples are generated with `example:color` code blocks. For example:
170 | ````css
171 | ```example:color
172 | @color: #ffffff @name: White
173 | @color: #f8f8f8 @name: White Smoke
174 | @color: #e7e7e7 @name: Whisper
175 | @color: #777777 @name: Grey
176 | @color: #565454 @name: Matterhorn
177 | @color: #4078c0 @name: Steel Blue
178 | @color: #333333 @name: Night Rider
179 | ```
180 | ````
181 | is rendered as:
182 | ```example:color
183 | @color: #ffffff @name: White
184 | @color: #f8f8f8 @name: White Smoke
185 | @color: #e7e7e7 @name: Whisper
186 | @color: #777777 @name: Grey
187 | @color: #565454 @name: Matterhorn
188 | @color: #4078c0 @name: Steel Blue
189 | @color: #333333 @name: Night Rider
190 | ```
191 | */
192 | 
193 | /*---
194 | title:   Order
195 | section: Overview
196 | ---
197 | The `order` heading detail is used to control the order of sections in the generated style guide. A negative order value will shift the item before non-ordered items, while a positive order value will push the item after non-ordered values.
198 | ```css
199 | /*---
200 | section: First Section
201 | order: -1
202 | ---
203 | ```
204 | Attached to a subsection, the order detail will control the position of the subsection inside the section.
205 | ```css
206 | /*---
207 | title:   Last Subsection
208 | section: Third Section
209 | order: 1
210 | ---
211 | */
212 | 
213 | /*---
214 | title:   Typography
215 | section: Overview
216 | ---
217 | This theme uses a common Helvetica font stack with a relative line height of
218 | 1.6 times the font size.
219 | */
220 | 
221 | /*---
222 | title:   Headings
223 | section: Typography
224 | ---
225 | Headings match GitHub documentation conventions.
226 | ```example:html
227 | 

Heading Level 1

228 |

Heading Level 2

229 |

Heading Level 3

230 |

Heading Level 4

231 |
Heading Level 5
232 |
Heading Level 6
233 | ``` 234 | */ 235 | 236 | /*--- 237 | title: Iconography 238 | section: Overview 239 | --- 240 | This theme uses no iconography. 241 | */ 242 | 243 | /*--- 244 | title: Layout 245 | --- 246 | We use flex to horizontally stack the heading and main content areas. 247 | The navigation remains fixed while you scroll. 248 | */ 249 | 250 | /*--- 251 | title: Visual Language 252 | --- 253 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 254 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 255 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 256 | perferendis quam! Ullam, debitis ab maiores. 257 | ```html 258 |
259 |
260 | 261 |
262 |
263 | ``` 264 | */ 265 | 266 | /*--- 267 | title: Hero 268 | section: Visual Language 269 | --- 270 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 271 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 272 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 273 | perferendis quam! Ullam, debitis ab maiores. 274 | */ 275 | 276 | /*--- 277 | title: Figure 278 | section: Visual Language 279 | --- 280 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 281 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 282 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 283 | perferendis quam! Ullam, debitis ab maiores. 284 | */ 285 | 286 | /*--- 287 | title: Blockquote 288 | section: Visual Language 289 | --- 290 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 291 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 292 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 293 | perferendis quam! Ullam, debitis ab maiores. 294 | */ 295 | 296 | /*--- 297 | title: Media 298 | section: Visual Language 299 | --- 300 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 301 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 302 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 303 | perferendis quam! Ullam, debitis ab maiores. 304 | */ 305 | 306 | /*--- 307 | title: Aspect 308 | section: Visual Language 309 | order: -1 310 | --- 311 | This is just a sample section. Lorem ipsum dolor sit amet, consectetur 312 | adipisicing elit. Reiciendis asperiores temporibus beatae fugit totam pariatur, 313 | aliquam commodi consequuntur id error ipsam suscipit quas doloremque 314 | perferendis quam! Ullam, debitis ab maiores. 315 | */ 316 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | var ejs = require('ejs'); 2 | var ext = require('object-assign'); 3 | var fs = require('fs'); 4 | var path = require('path'); 5 | 6 | module.exports = function (themeopts) { 7 | // set theme options object 8 | themeopts = Object(themeopts); 9 | 10 | // set theme logo 11 | themeopts.logo = themeopts.logo || 'mdcss-logo.png'; 12 | 13 | // set theme title 14 | themeopts.title = themeopts.title || 'Style Guide'; 15 | 16 | // set theme css 17 | themeopts.css = themeopts.css || ['primer.css', 'style.css', 'octicons/octicons.css']; 18 | 19 | // set theme css 20 | themeopts.js = themeopts.js || []; 21 | 22 | // set theme masthead color 23 | themeopts.color = themeopts.color || ['#4078c0']; 24 | 25 | // set navigation links 26 | themeopts.nav = themeopts.nav || []; 27 | 28 | // set example conf 29 | themeopts.examples = ext({ 30 | base: '', 31 | target: '_self', 32 | css: ['style.css'], 33 | js: [], 34 | bodyjs: [], 35 | htmlcss: 'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:0;position:static;width:auto', 36 | bodycss: 'background:none;border:0;clip:auto;display:block;height:auto;margin:0;padding:16px;position:static;width:auto' 37 | }, themeopts.examples); 38 | 39 | // return theme 40 | return function (docs) { 41 | // set assets directory and template 42 | docs.assets = path.join(__dirname, 'assets'); 43 | docs.template = path.join(__dirname, 'template.ejs'); 44 | 45 | // set theme options 46 | docs.themeopts = themeopts; 47 | 48 | // return promise 49 | return new Promise(function (resolve, reject) { 50 | // read template 51 | fs.readFile(docs.template, 'utf8', function (error, contents) { 52 | // throw if template could not be read 53 | if (error) reject(error); 54 | else { 55 | // set examples options 56 | docs.opts = ext({}, docs.opts, docs.themeopts); 57 | 58 | // set compiled template 59 | docs.template = ejs.compile(contents)(docs); 60 | 61 | // resolve docs 62 | resolve(docs); 63 | } 64 | }); 65 | }); 66 | }; 67 | }; 68 | 69 | module.exports.type = 'mdcss-theme'; 70 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mdcss-theme-github", 3 | "version": "2.4.2", 4 | "description": "GitHub flavored theme for mdcss", 5 | "keywords": [ 6 | "mdcss", 7 | "mdcss-theme", 8 | "github", 9 | "theme" 10 | ], 11 | "author": "Jonathan Neal (http://jonathantneal.com)", 12 | "license": "CC0-1.0", 13 | "repository": "jonathantneal/mdcss-github-theme", 14 | "bugs": "https://github.com/jonathantneal/mdcss-github-theme/issues", 15 | "homepage": "https://github.com/jonathantneal/mdcss-github-theme#readme", 16 | "dependencies": { 17 | "ejs": "^2.4.1", 18 | "object-assign": "^4.0.1" 19 | }, 20 | "devDependencies": { 21 | "chokidar": "^1.4.2", 22 | "eslint": "^1.10.3", 23 | "mdcss": "^1.5.1", 24 | "tap-spec": "^4.1.1", 25 | "tape": "^4.4.0", 26 | "watch": "^0.17.1" 27 | }, 28 | "scripts": { 29 | "lint": "eslint . --ignore-path .eshintignore", 30 | "tape": "tape test.js | tap-spec", 31 | "test": "npm run lint && npm run tape", 32 | "watch": "tape watch.js" 33 | }, 34 | "watch": { 35 | "test": [ 36 | "assets", 37 | "template.ejs" 38 | ] 39 | }, 40 | "engines": { 41 | "iojs": ">=2.0.0", 42 | "node": ">=0.12.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /template.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | <%- opts.title %> 7 | 8 | <% opts.css.forEach(function (href) { 9 | %><% 10 | }); %> 11 | 12 | <% opts.js.forEach(function (src) { 13 | %><% 14 | }); %> 15 | 16 | 17 |
18 |
19 | 22 | 27 |
28 |
29 | 30 |
31 |
32 |
33 | 36 |
37 | 38 |
39 | <% sections(list, 2) %> 40 |
41 |
42 |
43 | Last modified <%- lastModified() %> 44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 101 | <% analytics(opts.analytics) %> 102 | 103 | 104 | 105 | <% 106 | function analytics(ua) { 107 | %> 108 | <% if (ua) { 109 | %> 110 | 114 | 115 | <% 116 | } 117 | } 118 | 119 | function menu(children, depth) { 120 | %> 121 | <% if (depth < 3) getSorted(children).forEach(function (child) { 122 | if (child.name) { 123 | if (depth < 2) {modifier = "heading";} 124 | if (depth > 1) {modifier = "item";} 125 | %> 126 | <%= child.title %> 127 | <% if (child.children) menu(child.children, depth + 1) %> 128 | <% 129 | } 130 | }); %> 131 | <% 132 | } 133 | 134 | function sections(children, depth) { 135 | depth = Math.max(Math.min(depth, 6), 1); 136 | 137 | getSorted(children).forEach(function (child) { 138 | %> 139 | id="<%= child.name %>"<% } %>> 140 | <% if (child.title) { %><%- '' %><%= child.title %><%- '' %><% } %> 141 | 142 |
143 | <%- child.content %> 144 | <% if (child.children) sections(child.children, depth + 1) %> 145 |
146 | 147 | <% 148 | }); 149 | } 150 | 151 | function lastModified() { 152 | var now = new Date(); 153 | 154 | var day = 'Sunday Monday Tuesday Wednesday Thursday Friday Saturday'.split(' ')[now.getDay()]; 155 | 156 | var month = 'January February March April May June July August September October November December'.split(' ')[now.getMonth()]; 157 | 158 | return day + ', ' + now.getDate() + ' ' + month + ' ' + now.getFullYear() + ' ' + now.getHours() + ':' + ('0' + now.getMinutes()).slice(-2); 159 | } 160 | 161 | function getSorted(list) { 162 | // Map sort value to index if doesn't have an order. This makes it so if no order is provided, 163 | // the item's original position in the array is preserved 164 | const mapped = list.map(function (value, index) { 165 | return {order: value.order || value.order === 0 ? value.order : index, index: index}; 166 | }); 167 | mapped.sort(sort); 168 | 169 | // Return a copy of the original array mapped to the new sort order 170 | return mapped.map(function (el) { 171 | return list[el.index]; 172 | }); 173 | } 174 | 175 | function sort(childA, childB) { 176 | return (childA.order || 0) - (childB.order || 0); 177 | } 178 | 179 | %> 180 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | var mdcss = require('mdcss'); 2 | var fs = require('fs'); 3 | var path = require('path'); 4 | var plugin = require('./'); 5 | var test = require('tape'); 6 | 7 | test('mdcss-theme-github', function (t) { 8 | t.plan(1); 9 | 10 | var message = 'Test mdcss GitHub'; 11 | var options = { theme: plugin({ title: 'GitHub Theme', color: '#222222', nav: [{ name: 'mdcss', url: 'http://github.com/jonathantneal/mdcss' }] }), destination: 'demo' }; 12 | var warning = 0; 13 | var warningMsg = message + ' (# of warnings)'; 14 | 15 | var inputPath = path.resolve('assets/style.css'); 16 | var inputCSS = ''; 17 | 18 | try { 19 | inputCSS = fs.readFileSync(inputPath, 'utf8'); 20 | } catch (error) { 21 | fs.writeFileSync(inputPath, inputCSS); 22 | } 23 | 24 | mdcss.process(inputCSS, options).then(function (result) { 25 | t.equal(result.warnings().length, warning, warningMsg); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /watch.js: -------------------------------------------------------------------------------- 1 | var exec = require('child_process').exec; 2 | var chokidar = require('chokidar'); 3 | 4 | var watch = Object(require('./package').watch); 5 | 6 | Object.keys(watch).forEach(function (script) { 7 | var tree = watch[script]; 8 | 9 | chokidar.watch(tree, { ignoreInitial: true }).on('all', function () { 10 | exec('npm run ' + script, function (err, stdout) { 11 | if (!err) console.log(stdout); 12 | }); 13 | }); 14 | }); 15 | --------------------------------------------------------------------------------