Merge pull request #93 from squidfunk/rework

Merge rework into master for 1.0.0 release
This commit is contained in:
Martin Donath 2017-01-12 20:36:29 +01:00 committed by GitHub
commit 6e0f5799b4
191 changed files with 11534 additions and 6013 deletions

10
.babelrc Normal file
View File

@ -0,0 +1,10 @@
{
"presets": ["es2015"],
"plugins": [
"add-module-exports",
"babel-root-import",
["transform-react-jsx", {
"pragma": "JSX.createElement"
}]
]
}

31
.editorconfig Normal file
View File

@ -0,0 +1,31 @@
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Top-level config
root = true
# All files
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

24
.eslintignore Normal file
View File

@ -0,0 +1,24 @@
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Build files
/build
/material
/site

199
.eslintrc Normal file
View File

@ -0,0 +1,199 @@
{
"extends": "eslint:recommended",
"ecmaFeatures": {
"arrowFunctions": true,
"binaryLiterals": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": true,
"globalReturn": true,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": true,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"octalLiterals": true,
"regexUFlag": true,
"regexYFlag": true,
"spread": true,
"superInFunctions": false,
"templateStrings": true,
"unicodeCodePointEscapes": true
},
"env": {
"browser": true,
"es6": true,
"node": true
},
"globals": {
"Modernizr": true,
"navigator": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"impliedStrict": true,
"sourceType": "module"
},
"plugins": [],
"rules": {
"array-callback-return": 2,
"array-bracket-spacing": 2,
"arrow-parens": [2, "as-needed"],
"arrow-spacing": 2,
"block-scoped-var": 2,
"block-spacing": 2,
"brace-style": 2,
"camelcase": [2, {
"properties": "always"
}],
"comma-dangle": [2, "never"],
"comma-style": [2, "last"],
"complexity": 2,
"computed-property-spacing": 2,
"consistent-this": 2,
"dot-notation": 2,
"eol-last": 2,
"eqeqeq": 2,
"func-call-spacing": 2,
"func-names": [2, "never"],
"func-style": 2,
"generator-star-spacing": 2,
"indent": [2, 2, {
"FunctionDeclaration": {
"body": 1,
"parameters": 2
},
"FunctionExpression": {
"body": 1,
"parameters": 2
},
"MemberExpression": 1,
"VariableDeclarator": {
"var": 2,
"let": 2,
"const": 3
},
"SwitchCase": 1
}],
"init-declarations": 2,
"key-spacing": 2,
"keyword-spacing": 2,
"linebreak-style": 2,
"lines-around-comment": 2,
"lines-around-directive": 2,
"max-depth": 2,
"max-len": [1, {
"ignorePattern": "\/\/ TODO"
}],
"max-nested-callbacks": 2,
"max-params": 2,
"max-statements-per-line": 2,
"new-cap": 2,
"newline-per-chained-call": 2,
"no-array-constructor": 2,
"no-alert": 2,
"no-caller": 2,
"no-confusing-arrow": [2, {
"allowParens": false
}],
"no-console": 1,
"no-duplicate-imports": 2,
"no-eq-null": 2,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-bind": 2,
"no-floating-decimal": 2,
"no-global-assign": 2,
"no-invalid-this": 2,
"no-labels": 2,
"no-lone-blocks": 2,
"no-loop-func": 2,
"no-multiple-empty-lines": [1, {
"max": 1
}],
"no-nested-ternary": 2,
"no-new": 0,
"no-new-object": 2,
"no-param-reassign": 2,
"no-prototype-builtins": 2,
"no-shadow": 2,
"no-tabs": 2,
"no-template-curly-in-string": 2,
"no-throw-literal": 2,
"no-trailing-spaces": 2,
"no-undefined": 2,
"no-underscore-dangle": [2, {
"allowAfterThis": true,
"allowAfterSuper": true
}],
"no-unneeded-ternary": 2,
"no-unsafe-negation": 2,
"no-unused-expressions": 2,
"no-unused-vars": 1,
"no-use-before-define": 2,
"no-useless-call": 2,
"no-useless-computed-key": 2,
"no-useless-constructor": 2,
"no-useless-rename": 2,
"no-var": 2,
"no-whitespace-before-property": 2,
"no-with": 2,
"object-curly-spacing": [2, "always"],
"object-shorthand": 2,
"one-var-declaration-per-line": 2,
"operator-assignment": 2,
"prefer-arrow-callback": 2,
"prefer-const": 2,
"prefer-numeric-literals": 2,
"prefer-spread": 2,
"prefer-template": 2,
"quotes": [2, "double"],
"radix": 2,
"require-jsdoc": [1, {
"require": {
"FunctionDeclaration": true,
"MethodDefinition": true,
"ClassDeclaration": false
}
}],
"rest-spread-spacing": 2,
"semi": [2, "never"],
"semi-spacing": 2,
"space-before-function-paren": [2, "never"],
"space-in-parens": 2,
"space-infix-ops": 2,
"space-unary-ops": 2,
"spaced-comment": [2, "always", {
"line": {
"markers": ["/"],
"exceptions": ["-", "+"]
},
"block": {
"markers": ["!"],
"exceptions": ["*"],
"balanced": true
}
}],
"strict": 2,
"template-curly-spacing": 2,
"unicode-bom": 2,
"valid-jsdoc": [1, {
"prefer": {
"arg": "param",
"argument": "param",
"class": "constructor",
"returns": "return",
"virtual": "abstract"
},
"requireParamDescription": true,
"requireReturn": false,
"requireReturnDescription": true
}],
"yield-star-spacing": 2
},
"root": true
}

View File

@ -0,0 +1,30 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Check, if all changes are added to the index
CHANGED="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)"
# Perform install and prune of NPM dependencies if package.json changed
if $(echo "$CHANGED" | grep --quiet package.json); then
echo "Hook[post-merge]: Updating dependencies..."
npm install && npm prune
fi

51
.githooks/pre-commit/lint.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Patch file to store unindexed changes
PATCH_FILE=".working-tree.patch"
# Revert changes that have been registered in the patch file
function cleanup {
EXIT_CODE=$?
if [ -f "$PATCH_FILE" ]; then
git apply "$PATCH_FILE" 2> /dev/null
rm "$PATCH_FILE"
fi
exit $EXIT_CODE
}
# Register signal handlers
trap cleanup EXIT SIGINT SIGHUP
# Cancel any changes to the working tree that are not going to be committed
git diff > "$PATCH_FILE"
git checkout -- .
# Filter relevant files for linting
FILES=$(git diff --cached --name-only --diff-filter=ACMR | \
grep "\.\(js\|jsx\|scss\)$")
# Run the check and print indicator
if [ "$FILES" ]; then
echo "Hook[pre-commit]: Running linter..."
npm run lint --silent || exit 1
fi

21
.gitignore vendored
View File

@ -1,4 +1,4 @@
# Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
@ -18,18 +18,19 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Mac OS X internals
# macOS internals
.DS_Store
# Bower and NPM libraries
bower_components
node_modules
# NPM-related
/node_modules
/npm-debug.log
# Build files
build
MANIFEST
site
/build
/manifest.json
/MANIFEST
/site
# Distribution files
dist
mkdocs_material.egg-info
/dist
/mkdocs_material.egg-info

191
.stylelintrc Normal file
View File

@ -0,0 +1,191 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-order",
"stylelint-scss"
],
"rules": {
"at-rule-empty-line-before": null,
"at-rule-no-vendor-prefix": true,
"block-opening-brace-space-before": null,
"block-closing-brace-newline-after": ["always", {
"ignoreAtRules": [
"if",
"else",
"elseif"
]
}],
"color-hex-case": "upper",
"color-hex-length": "long",
"color-named": "never",
"comment-empty-line-before": ["always", {
"ignore": ["stylelint-commands"]
}],
"font-family-name-quotes": "always-where-recommended",
"font-weight-notation": "numeric",
"function-url-quotes": "always",
"no-unknown-animations": true,
"order/declaration-block-order": [
"custom-properties",
"declarations"
],
"order/declaration-block-properties-specified-order": [
"display",
"position",
"top",
"right",
"bottom",
"left",
"flex",
"flex-basis",
"flex-direction",
"flex-flow",
"flex-grow",
"flex-shrink",
"flex-wrap",
"align-content",
"align-items",
"align-self",
"justify-content",
"order",
"width",
"min-width",
"max-width",
"height",
"min-height",
"max-height",
"margin",
"margin-top",
"margin-right",
"margin-bottom",
"margin-left",
"padding",
"padding-top",
"padding-right",
"padding-bottom",
"padding-left",
"float",
"clear",
"clip",
"columns",
"column-gap",
"column-fill",
"column-rule",
"column-span",
"column-count",
"column-width",
"transform",
"transform-box",
"transform-origin",
"transform-style",
"transition",
"transition-delay",
"transition-duration",
"transition-property",
"transition-timing-function",
"border",
"border-top",
"border-right",
"border-bottom",
"border-left",
"border-width",
"border-top-width",
"border-right-width",
"border-bottom-width",
"border-left-width",
"border-style",
"border-top-style",
"border-right-style",
"border-bottom-style",
"border-left-style",
"border-radius",
"border-top-left-radius",
"border-top-right-radius",
"border-bottom-left-radius",
"border-bottom-right-radius",
"border-color",
"border-top-color",
"border-right-color",
"border-bottom-color",
"border-left-color",
"outline",
"outline-color",
"outline-offset",
"outline-style",
"outline-width",
"background",
"background-attachment",
"background-clip",
"background-color",
"background-image",
"background-repeat",
"background-position",
"background-size",
"color",
"font",
"font-family",
"font-size",
"font-smoothing",
"font-style",
"font-variant",
"font-weight",
"letter-spacing",
"line-height",
"list-style",
"text-align",
"text-decoration",
"text-indent",
"text-overflow",
"text-rendering",
"text-shadow",
"text-transform",
"text-wrap",
"white-space",
"word-spacing",
"border-collapse",
"border-spacing",
"box-shadow",
"caption-side",
"content",
"cursor",
"empty-cells",
"opacity",
"overflow",
"quotes",
"speak",
"table-layout",
"vertical-align",
"visibility",
"z-index"
],
"property-no-vendor-prefix": true,
"root-no-standard-properties": true,
"selector-class-pattern": "^[a-z0-9]+(-[a-z0-9]+)*(__[a-z]+)?(--[a-z]+)?$",
"selector-descendant-combinator-no-non-space": null,
"string-quotes": "double",
"unit-whitelist": ["rem", "em", "deg", "s", "%", "mm", "vh"],
"value-keyword-case": "lower",
"value-no-vendor-prefix": true
}
}

View File

@ -1,4 +1,4 @@
# Copyright (c) 2013-2016 Martin Donath <martin.donath@squidfunk.com>
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
@ -19,20 +19,23 @@
# IN THE SOFTWARE.
language: node_js
sudo: false
# Node.js versions
node_js:
- 4
- 5
- 6
# Cache dependencies
cache:
pip: true
directories:
- node_modules
# Install dependencies
before_script:
# Install bower
- npm install -g bower
# Install project dependencies
- npm install
- bower install
- pip install --user -r requirements.txt
# Perform build and tests
script: gulp build --production
script: npm run build

View File

@ -1,6 +1,35 @@
mkdocs-material-1.0.0 (2017-01-13)
* Introduced Webpack for more sophisticated JavaScript bundling
* Introduced ESLint and Stylelint for code style checks
* Introduced more accurate Material Design colors and shadows
* Introduced modular scales for harmonic font sizing
* Introduced git-hooks for better development workflow
* Rewrite of CSS using the BEM methodology and SassDoc guidelines
* Rewrite of JavaScript using ES6 and Babel as a transpiler
* Rewrite of Admonition, Permalinks and CodeHilite integration
* Rewrite of the complete typographical system
* Rewrite of Gulp asset pipeline in ES6 and separation of tasks
* Removed Bower as a dependency in favor of NPM
* Removed custom icon build in favor of the Material Design iconset
* Removed _blank targets on links due to vulnerability: http://bit.ly/1Mk2Rtw
* Removed unversioned assets from build directory
* Restructured templates into base templates and partials
* Added build and watch scripts in package.json
* Added support for Metadata and Footnotes Markdown extensions
* Added support for pymdownx.* Markdown extensions
* Added support for collapsible sections in navigation
* Added support for separate table of contents
* Added support for better accessibility through REM-based layout
* Added icons for GitHub, GitLab and BitBucket integrations
* Added more detailed documentation on specimen, extensions etc.
* Added a 404.html error page for deployment on GitHub Pages
* Fixed live reload chain in watch mode when saving a template
* Fixed variable references to work with MkDocs 0.16
mkdocs-material-0.2.4 (2016-06-26)
* Fixed improperly set set default favicon
* Fixed improperly set default favicon
* Fixed #33: Protocol relative URL for webfonts doesn't work with file://
* Fixed #34: IE11 on Windows 7 doesn't honor max-width on main tag
* Fixed #35: Add styling for blockquotes
@ -13,7 +42,7 @@ mkdocs-material-0.2.3 (2016-05-16)
mkdocs-material-0.2.2 (2016-03-20)
* Fixed #15: Document pygments dependency for codehilite
* Fixed #15: Document Pygments dependency for CodeHilite
* Fixed #16: Favicon could not be set through mkdocs.yml
* Fixed #17: Put version into own container for styling
* Fixed #20: Fix rounded borders for tables
@ -53,11 +82,11 @@ mkdocs-material-0.1.2 (2016-02-16)
mkdocs-material-0.1.1 (2016-02-11)
* Fixed #1: GitHub stars don't work if the repo_url ends with a '/'
* Updated npm and bower dependencies to most recent versions
* Updated NPM and Bower dependencies to most recent versions
* Changed footer/copyright link to Material theme to GitHub pages
* Made MkDocs building/serving in build process optional
* Set up continuous integration with travis-ci.org
* Set up continuous integration with Travis
mkdocs-material-0.1.0 (2016-02-09)
* Initial release
* Initial release

View File

@ -1,7 +1,7 @@
# Contributing
Interested in contributing to the Material theme? Before you do, please read
the following guidelines.
Interested in contributing to the Material theme? Want to report a bug? Before
you do, please read the following guidelines.
## Submission context
@ -15,8 +15,12 @@ For quick questions there's no need to open an issue as you can reach us on
### Found a bug?
If you found a bug in the source code, you can help us by submitting an issue
to our GitHub Repository. Even better, you can submit a Pull Request with a
fix. However, before doing so, read the submission guidelines.
to the [issue tracker][2] in our GitHub repository. Even better, you can submit
a Pull Request with a fix. However, before doing so, please read the
[submission guidelines][3].
[2]: https://github.com/squidfunk/mkdocs-material/issues
[3]: #submission-guidelines
### Missing a feature?
@ -47,20 +51,31 @@ readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we
need to reproduce and confirm it. In order to reproduce bugs we will
systematically ask you to provide a minimal reproduction scenario using the
custom issue template.
custom issue template. Please stick to the issue template.
Unfortunately we are not able to investigate / fix bugs without a minimal
reproduction, so if we don't hear back from you we are going to close issues
that don't have enough information to be reproduced.
reproduction scenario, so if we don't hear back from you we may close the issue.
### Submitting a Pull Request (PR)
Search GitHub for an open or closed PR that relates to your submission. You
don't want to duplicate effort. Fork the project, make your changes in **a new
git branch** and commit your changes with a descriptive commit message. Then
push your branch to GitHub and send a PR to `mkdocs-material:master`. If we
suggest changes, make the required updates, rebase your branch and push
the changes to your GitHub repository, which will automatiaclly update your PR.
don't want to duplicate effort. If you do not find a related issue or PR,
go ahead.
1. **Development**: Fork the project, set up the [development environment][4],
make your changes in a separate git branch and add descriptive messages to
your commits.
2. **Build**: Before submitting a pull requests, build the theme. This is a
mandatory requirement for your PR to get accepted, as the theme should at
all times be installable through GitHub.
3. **Pull Request**: After building the theme, commit the compiled output, push
your branch to GitHub and send a PR to `mkdocs-material:master`. If we
suggest changes, make the required updates, rebase your branch and push the
changes to your GitHub repository, which will automatically update your PR.
After your PR is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository.
[4]: http://localhost:8000/customization/#theme-development

343
Gulpfile.babel.js Executable file
View File

@ -0,0 +1,343 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import gulp from "gulp"
import notifier from "node-notifier"
import plumber from "gulp-plumber"
import util from "gulp-util"
import yargs from "yargs"
/* ----------------------------------------------------------------------------
* Configuration and arguments
* ------------------------------------------------------------------------- */
const config = {
assets: {
src: "src/assets", /* Source directory for assets */
build: "material/assets" /* Target directory for assets */
},
lib: "lib", /* Libraries */
views: {
src: "src", /* Source directory for views */
build: "material" /* Target directory for views */
}
}
const args = yargs
.default("clean", false) /* Clean before build */
.default("karma", true) /* Karma watchdog */
.default("lint", true) /* Lint sources */
.default("mkdocs", true) /* MkDocs watchdog */
.default("optimize", false) /* Optimize sources */
.default("revision", false) /* Revision assets */
.default("sourcemaps", false) /* Create sourcemaps */
.argv
/* ----------------------------------------------------------------------------
* Overrides and helpers
* ------------------------------------------------------------------------- */
/*
* Override gulp.src() for nicer error handling.
*/
const src = gulp.src
gulp.src = (...glob) => {
return src.apply(gulp, glob)
.pipe(
plumber(function(error) {
util.log(util.colors.red(
`Error (${error.plugin}): ${error.message}`
))
/* Extract file where error happened, if existent */
const file = error.relativePath
? error.relativePath.split("/").pop()
: ""
/* Dispatch system-level notification */
notifier.notify({
title: `Error (${error.plugin}): ${file}`,
message: error.messageOriginal
})
// eslint-disable-next-line no-invalid-this
this.emit("end")
/* Throw error and abort, if not in watch mode */
if (args._[0] !== "watch")
throw error
}))
}
/*
* Helper function to load a task
*/
const load = task => {
return require(`./${config.lib}/tasks/${task}`)(gulp, config, args)
}
/* ----------------------------------------------------------------------------
* Images
* ------------------------------------------------------------------------- */
/*
* Copy favicon
*/
gulp.task("assets:images:build:ico",
load("assets/images/build/ico"))
/*
* Copy and minify vector graphics
*/
gulp.task("assets:images:build:svg",
load("assets/images/build/svg"))
/*
* Copy images
*/
gulp.task("assets:images:build", args.clean ? [
"assets:images:clean"
] : [], () => {
return gulp.start([
"assets:images:build:ico",
"assets:images:build:svg"
])
})
/*
* Clean images generated by build
*/
gulp.task("assets:images:clean",
load("assets/images/clean"))
/* ----------------------------------------------------------------------------
* JavaScript
* ------------------------------------------------------------------------- */
/*
* Build application logic
*/
gulp.task("assets:javascripts:build:application",
load("assets/javascripts/build/application"))
/*
* Build custom modernizr
*/
gulp.task("assets:javascripts:build:modernizr", [
"assets:stylesheets:build"
], load("assets/javascripts/build/modernizr"))
/*
* Build application logic and modernizr
*/
gulp.task("assets:javascripts:build", (args.clean ? [
"assets:javascripts:clean"
] : []).concat(args.lint ? [
"assets:javascripts:lint"
] : []), () => {
return gulp.start([
"assets:javascripts:build:application",
"assets:javascripts:build:modernizr"
])
})
/*
* Clean JavaScript generated by build
*/
gulp.task("assets:javascripts:clean",
load("assets/javascripts/clean"))
/*
* Lint JavaScript
*/
gulp.task("assets:javascripts:lint",
load("assets/javascripts/lint"))
/* ----------------------------------------------------------------------------
* Stylesheets
* ------------------------------------------------------------------------- */
/*
* Build stylesheets from SASS source
*/
gulp.task("assets:stylesheets:build", (args.clean ? [
"assets:stylesheets:clean"
] : []).concat(args.lint ? [
"assets:stylesheets:lint"
] : []),
load("assets/stylesheets/build"))
/*
* Clean stylesheets generated by build
*/
gulp.task("assets:stylesheets:clean",
load("assets/stylesheets/clean"))
/*
* Lint SASS sources
*/
gulp.task("assets:stylesheets:lint",
load("assets/stylesheets/lint"))
/* ----------------------------------------------------------------------------
* Assets
* ------------------------------------------------------------------------- */
/*
* Build assets
*/
gulp.task("assets:build", [
"assets:images:build",
"assets:javascripts:build",
"assets:stylesheets:build"
])
/*
* Clean files generated by build
*/
gulp.task("assets:clean", [
"assets:images:clean",
"assets:javascripts:clean",
"assets:stylesheets:clean"
])
/* ----------------------------------------------------------------------------
* Views
* ------------------------------------------------------------------------- */
/*
* Minify views
*/
gulp.task("views:build", (args.revision ? [
"assets:images:build",
"assets:stylesheets:build",
"assets:javascripts:build"
] : []).concat(args.clean ? [
"views:clean"
] : []), load("views/build"))
/*
* Clean views
*/
gulp.task("views:clean",
load("views/clean"))
/* ----------------------------------------------------------------------------
* MkDocs
* ------------------------------------------------------------------------- */
/*
* Build documentation
*/
gulp.task("mkdocs:build", [
"assets:build",
"views:build",
"mkdocs:clean"
], load("mkdocs/build"))
/*
* Clean documentation build
*/
gulp.task("mkdocs:clean",
load("mkdocs/clean"))
/*
* Restart MkDocs server
*/
gulp.task("mkdocs:serve",
load("mkdocs/serve"))
/* ----------------------------------------------------------------------------
* Tests
* ------------------------------------------------------------------------- */
/*
* Start karma test runner
*/
gulp.task("tests:unit:watch",
load("tests/unit/watch"))
/* ----------------------------------------------------------------------------
* Interface
* ------------------------------------------------------------------------- */
/*
* Build assets and documentation
*/
gulp.task("build", [
"assets:build",
"views:build"
].concat(args.mkdocs
? "mkdocs:build"
: []))
/*
* Clean assets and documentation
*/
gulp.task("clean", [
"assets:clean",
"views:clean",
"mkdocs:clean"
])
/*
* Watch for changes and rebuild assets on the fly
*/
gulp.task("watch", [
"assets:build",
"views:build"
], () => {
process.env.WATCH = true
/* Start MkDocs server */
if (args.mkdocs)
gulp.start("mkdocs:serve")
/* Start karma test runner */
// if (args.karma)
// gulp.start("tests:unit:watch")
/* Rebuild stylesheets */
gulp.watch([
`${config.assets.src}/stylesheets/**/*.scss`
], ["assets:stylesheets:build"])
/* Rebuild JavaScript */
gulp.watch([
`${config.assets.src}/javascripts/**/*.{js,jsx}`
], ["assets:javascripts:build:application"])
/* Copy images */
gulp.watch([
`${config.assets.src}/images/**/*`
], ["assets:images:build"])
/* Minify views */
gulp.watch([
`${config.views.src}/**/*.html`
], ["views:build"])
})
/*
* Build assets by default
*/
gulp.task("default", ["build"])

View File

@ -1,332 +0,0 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/* ----------------------------------------------------------------------------
* Imports
* ------------------------------------------------------------------------- */
var gulp = require('gulp');
var addsrc = require('gulp-add-src');
var args = require('yargs').argv;
var autoprefix = require('autoprefixer');
var child = require('child_process');
var clean = require('del');
var collect = require('gulp-rev-collector');
var compact = require('gulp-remove-empty-lines');
var concat = require('gulp-concat');
var ignore = require('gulp-ignore');
var gulpif = require('gulp-if');
var mincss = require('gulp-cssnano');
var minhtml = require('gulp-htmlmin');
var minimage = require('gulp-image-optimization');
var modernizr = require('gulp-modernizr');
var mqpacker = require('css-mqpacker');
var notifier = require('node-notifier');
var plumber = require('gulp-plumber');
var postcss = require('gulp-postcss');
var rev = require('gulp-rev');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var util = require('gulp-util');
var vinyl = require('vinyl-paths');
/* ----------------------------------------------------------------------------
* Locals
* ------------------------------------------------------------------------- */
/* MkDocs server */
var server = null;
/* ----------------------------------------------------------------------------
* Overrides
* ------------------------------------------------------------------------- */
/*
* Override gulp.src() for nicer error handling.
*/
var src = gulp.src;
gulp.src = function() {
return src.apply(gulp, arguments)
.pipe(
plumber(function(error) {
util.log(util.colors.red(
'Error (' + error.plugin + '): ' + error.message
));
notifier.notify({
title: 'Error (' + error.plugin + ')',
message: error.message.split('\n')[0]
});
this.emit('end');
}));
};
/* ----------------------------------------------------------------------------
* Asset pipeline
* ------------------------------------------------------------------------- */
/*
* Build stylesheets from SASS source.
*/
gulp.task('assets:stylesheets', function() {
return gulp.src('src/assets/stylesheets/*.scss')
.pipe(gulpif(args.sourcemaps, sourcemaps.init()))
.pipe(
sass({
includePaths: [
'bower_components/bourbon/app/assets/stylesheets/',
'bower_components/quantum-colors/',
'bower_components/quantum-shadows/'
]
}))
.pipe(
postcss([
autoprefix(),
mqpacker
]))
.pipe(gulpif(args.sourcemaps, sourcemaps.write()))
.pipe(gulpif(args.production, mincss()))
.pipe(gulp.dest('material/assets/stylesheets/'));
});
/*
* Build javascripts from Bower components and source.
*/
gulp.task('assets:javascripts', function() {
return gulp.src([
/* Bower components */
'bower_components/classlist/classList.js',
'bower_components/fastclick/lib/fastclick.js',
'bower_components/pegasus/dist/pegasus.js',
'bower_components/lunr.js/lunr.js',
/* Application javascripts */
'src/assets/javascripts/application.js',
'src/assets/javascripts/standalone.js'
]).pipe(gulpif(args.sourcemaps, sourcemaps.init()))
.pipe(concat('application.js'))
.pipe(gulpif(args.sourcemaps, sourcemaps.write()))
.pipe(gulpif(args.production, uglify()))
.pipe(gulp.dest('material/assets/javascripts/'));
});
/*
* Create a customized modernizr build.
*/
gulp.task('assets:modernizr', [
'assets:stylesheets',
'assets:javascripts'
], function() {
return gulp.src([
'material/assets/stylesheets/application.css',
'material/assets/javascripts/application.js'
]).pipe(
modernizr({
options: [
'addTest', /* Add custom tests */
'fnBind', /* Use function.bind */
'html5printshiv', /* HTML5 support for IE */
'setClasses', /* Add CSS classes to root tag */
'testProp' /* Test for properties */
]
}))
.pipe(addsrc.append('bower_components/respond/dest/respond.src.js'))
.pipe(concat('modernizr.js'))
.pipe(gulpif(args.production, uglify()))
.pipe(gulp.dest('material/assets/javascripts'));
});
/*
* Copy static assets like images and webfonts.
*/
gulp.task('assets:static', function() {
return gulp.src('src/assets/{fonts,images}/*.{jpg,png,gif}')
.pipe(gulpif(args.production,
minimage({
optimizationLevel: 5,
progressive: true,
interlaced: true
})))
.pipe(addsrc.append('src/assets/{fonts,images}/*.{ico,eot,svg,ttf,woff}'))
.pipe(gulp.dest('material/assets/'));
});
/*
* Minify views.
*/
gulp.task('assets:views', args.production ? [
'assets:modernizr',
'assets:revisions:clean',
'assets:revisions'
] : [], function() {
return gulp.src([
'src/*.html'
]).pipe(
minhtml({
collapseBooleanAttributes: true,
removeComments: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}))
.pipe(compact())
.pipe(gulpif(args.production,
addsrc.append([
'material/manifest.json',
'material/**/*.css'
])))
.pipe(gulpif(args.production, collect()))
.pipe(ignore.exclude(/manifest\.json$/))
.pipe(gulp.dest('material'));
});
/*
* Clean outdated revisions.
*/
gulp.task('assets:revisions:clean', function() {
return gulp.src(['material/**/*.{ico,css,js,png,jpg,gif}'])
.pipe(ignore.include(/-[a-f0-9]{8,}\.(ico|css|js|png|jpg|gif)$/))
.pipe(vinyl(clean));
});
/*
* Revision assets after build.
*/
gulp.task('assets:revisions', [
'assets:revisions:clean',
'assets:stylesheets',
'assets:javascripts',
'assets:static'
], function() {
return gulp.src(['material/**/*.{ico,css,js,png,jpg,gif}'])
.pipe(ignore.exclude(/-[a-f0-9]{8,}\.(css|js|png|jpg|gif)$/))
.pipe(rev())
.pipe(gulp.dest('material'))
.pipe(rev.manifest('manifest.json'))
.pipe(gulp.dest('material'));
});
/*
* Build assets.
*/
gulp.task('assets:build', [
'assets:stylesheets',
'assets:javascripts',
'assets:modernizr',
'assets:static',
'assets:views'
]);
/*
* Watch assets for changes and rebuild on the fly.
*/
gulp.task('assets:watch', function() {
/* Rebuild stylesheets */
gulp.watch([
'src/assets/stylesheets/**/*.scss'
], ['assets:stylesheets']);
/* Rebuild javascripts */
gulp.watch([
'src/assets/javascripts/**/*.js',
'bower.json'
], ['assets:javascripts']);
/* Copy static assets */
gulp.watch([
'src/assets/{fonts,images}/*'
], ['assets:static']);
/* Minify views */
gulp.watch([
'src/*.html'
], ['assets:views']);
});
/* ----------------------------------------------------------------------------
* Application server
* ------------------------------------------------------------------------- */
/*
* Build documentation.
*/
gulp.task('mkdocs:build', [
'assets:build'
], function() {
return child.spawnSync('mkdocs', ['build']);
});
/*
* Restart MkDocs server.
*/
gulp.task('mkdocs:serve', function() {
if (server)
server.kill();
/* Spawn MkDocs server */
server = child.spawn('mkdocs', ['serve', '-a', '0.0.0.0:8000']);
/* Pretty print server log output */
server.stdout.on('data', function(data) {
var lines = data.toString().split('\n')
for (var l in lines)
if (lines[l].length)
util.log(lines[l]);
});
/* Print errors to stdout */
server.stderr.on('data', function(data) {
process.stdout.write(data.toString());
});
});
/* ----------------------------------------------------------------------------
* Interface
* ------------------------------------------------------------------------- */
/*
* Build assets and documentation.
*/
gulp.task('build', [
'assets:build'
].concat(args.mkdocs
? 'mkdocs:build'
: []));
/*
* Start asset and MkDocs watchdogs.
*/
gulp.task('watch', [
'assets:build',
], function() {
return gulp.start([
'assets:watch'
].concat(args.mkdocs
? 'mkdocs:serve'
: []));
});
/*
* Build assets by default.
*/
gulp.task('default', ['build']);

View File

@ -1,4 +1,4 @@
Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to

View File

@ -1,2 +1,5 @@
recursive-include material *.ico *.js *.css *.html *.eot *.svg *.ttf *.woff
recursive-exclude site *
recursive-include material *.ico *.js *.css *.html *.svg
recursive-exclude site *
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
include LICENSE

View File

@ -1,18 +1,19 @@
# Material
[![Travis CI][travis-image]][travis-link]
[![PyPI Version][pypi-v-image]][pypi-v-link]
[![Travis][travis-image]][travis-link]
[![Codacy][codacy-image]][codacy-link]
[![PyPI][pypi-image]][pypi-link]
A material design theme for [MkDocs](http://www.mkdocs.org).
A Material Design theme for [MkDocs](http://www.mkdocs.org).
**Note: the theme is currently undergoing a complete rewrite for 1.0.0 which should be
released shortly.**
TBD: [![_](docs/images/screen.png)](http://squidfunk.github.io/mkdocs-material/)
* To get a glimpse, checkout the
[rework](https://github.com/squidfunk/mkdocs-material/tree/rework) branch
* To give feedback on the rework version, please see issues [#46](https://github.com/squidfunk/mkdocs-material/issues/46)
[![iOS](docs/images/screen.png)](http://squidfunk.github.io/mkdocs-material/)
[travis-image]: https://travis-ci.org/squidfunk/mkdocs-material.svg
[travis-link]: https://travis-ci.org/squidfunk/mkdocs-material
[codacy-image]: https://api.codacy.com/project/badge/Grade/fe07aa1fa91d453cb69711d3885c5d7e
[codacy-link]: https://www.codacy.com/app/squidfunk/mkdocs-material?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=squidfunk/mkdocs-material&amp;utm_campaign=Badge_Grade
[pypi-image]: https://img.shields.io/pypi/v/mkdocs-material.svg
[pypi-link]: https://pypi.python.org/pypi/mkdocs-material
## Quick start
@ -35,7 +36,7 @@ http://squidfunk.github.io/mkdocs-material/
**MIT License**
Copyright (c) 2016 Martin Donath
Copyright (c) 2016-2017 Martin Donath
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@ -54,8 +55,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
[travis-image]: https://travis-ci.org/squidfunk/mkdocs-material.svg?branch=master
[travis-link]: https://travis-ci.org/squidfunk/mkdocs-material
[pypi-v-image]: https://img.shields.io/pypi/v/mkdocs-material.png
[pypi-v-link]: https://pypi.python.org/pypi/mkdocs-material

View File

@ -1,31 +0,0 @@
{
"name": "mkdocs-material",
"version": "0.2.4",
"description": "A material design theme for MkDocs",
"homepage": "http://squidfunk.github.io/mkdocs-material/",
"authors": [
"squidfunk <martin.donath@squidfunk.com>"
],
"license": "MIT",
"moduleType": [
"globals"
],
"ignore": [
"**/.*",
"bower_components",
"node_modules"
],
"private": true,
"dependencies": {
"classlist": "^2014.12.13",
"fastclick": "^1.0.6",
"lunr.js": "^0.6.0",
"pegasus": "0.3.3",
"respond": "^1.4.2"
},
"devDependencies": {
"bourbon": "^4.2.6",
"quantum-colors": "^1.0.1",
"quantum-shadows": "^1.0.0"
}
}

81
docs/contributing.md Normal file
View File

@ -0,0 +1,81 @@
# Contributing
Interested in contributing to the Material theme? Want to report a bug? Before
you do, please read the following guidelines.
## Submission context
### Got a question or problem?
For quick questions there's no need to open an issue as you can reach us on
[gitter.im][1].
[1]: https://gitter.im/mkdocs-material/general
### Found a bug?
If you found a bug in the source code, you can help us by submitting an issue
to the [issue tracker][2] in our GitHub repository. Even better, you can submit
a Pull Request with a fix. However, before doing so, please read the
[submission guidelines][3].
[2]: https://github.com/squidfunk/mkdocs-material/issues
[3]: #submission-guidelines
### Missing a feature?
You can request a new feature by submitting an issue to our GitHub Repository.
If you would like to implement a new feature, please submit an issue with a
proposal for your work first, to be sure that it is of use for everyone, as
the Material theme is highly opinionated. Please consider what kind of change
it is:
* For a **major feature**, first open an issue and outline your proposal so
that it can be discussed. This will also allow us to better coordinate our
efforts, prevent duplication of work, and help you to craft the change so
that it is successfully accepted into the project.
* **Small features and bugs** can be crafted and directly submitted as a Pull
Request. However, there is no guarantee that your feature will make it into
the master, as it's always a matter of opinion whether if benefits the
overall functionality of the theme.
## Submission guidelines
### Submitting an issue
Before you submit an issue, please search the issue tracker, maybe an issue for
your problem already exists and the discussion might inform you of workarounds
readily available.
We want to fix all the issues as soon as possible, but before fixing a bug we
need to reproduce and confirm it. In order to reproduce bugs we will
systematically ask you to provide a minimal reproduction scenario using the
custom issue template. Please stick to the issue template.
Unfortunately we are not able to investigate / fix bugs without a minimal
reproduction scenario, so if we don't hear back from you we may close the issue.
### Submitting a Pull Request (PR)
Search GitHub for an open or closed PR that relates to your submission. You
don't want to duplicate effort. If you do not find a related issue or PR,
go ahead.
1. **Development**: Fork the project, set up the [development environment][4],
make your changes in a separate git branch and add descriptive messages to
your commits.
2. **Build**: Before submitting a pull requests, build the theme. This is a
mandatory requirement for your PR to get accepted, as the theme should at
all times be installable through GitHub.
3. **Pull Request**: After building the theme, commit the compiled output, push
your branch to GitHub and send a PR to `mkdocs-material:master`. If we
suggest changes, make the required updates, rebase your branch and push the
changes to your GitHub repository, which will automatically update your PR.
After your PR is merged, you can safely delete your branch and pull the changes
from the main (upstream) repository.
[4]: http://localhost:8000/customization/#theme-development

View File

@ -1,104 +1,240 @@
# Customization
## A good starting point
## A great starting point
Project documentation is as diverse as the projects themselves and the Material
theme is a good starting point for making it look good. However, as you write
theme is a good starting point for making it look great. However, as you write
your documentation, you may reach some point where some small adjustments are
necessary to preserve the style.
## Small tweaks
## Adding assets
[MkDocs][] provides a simple way for making small adjustments, that is changing
some margins, centering text, etc. Simply put the CSS and Javascript files that
contain your adjustments in the `docs` directory (ideally in subdirectories of
their own) and include them via the `extra_css` and `extra_javascript`
variables in your `mkdocs.yml`:
[MkDocs][1] provides several ways to interfere with themes. In order to make a
few tweaks to an existing theme, you can just add your stylesheets and
JavaScript files to the `docs` directory.
``` yaml
extra_css: ['/stylesheets/extra.css']
extra_javascript: ['/javascripts/extra.js']
```
[1]: http://www.mkdocs.org
Further assistance on including extra CSS and Javascript can be found in the
[MkDocs documentation][].
### Additional stylesheets
## Fundamental changes
If you want to make larger adjustments like changing the color palette or
typography, you should check out or download the repository of the project and
compile the SASS sources with your changes. The project design is very modular,
so most things can be tweaked by changing a few variables.
### Setup
In order to compile the project, you need `node` with a version greater than
`0.11` up and running. Then, make sure `bower` is installed or install it:
If you want to tweak some colors or change the spacing of certain elements,
you can do this in a separate stylesheet. The easiest way is by creating a
new stylesheet file in your `docs` directory:
``` sh
npm install -g bower
mkdir docs/stylesheets
touch docs/stylesheets/extra.css
```
The project itself is hosted on GitHub, so the next
thing you should do is clone the project from GitHub:
Then, add the following line to your `mkdocs.yml`:
``` yaml
extra_css:
- 'stylesheets/extra.css'
```
Spin up the development server with `mkdocs serve` and start typing your
changes in your additional stylesheet file you can see them instantly after
saving, as the MkDocs development server implements live reloading.
### Additional JavaScript
The same is true for additional JavaScript. If you want to integrate another
syntax highlighter or add some custom logic to your theme, create a new
JavaScript file in your `docs` directory:
``` sh
mkdir docs/javascripts
touch docs/javascripts/extra.js
```
Then, add the following line to your `mkdocs.yml`:
``` yaml
extra_javascript:
- 'javascripts/extra.js'
```
Further assistance can be found in the [MkDocs documentation][2].
[2]: http://www.mkdocs.org/user-guide/styling-your-docs/#customizing-a-theme
## Extending the theme
If you want to alter the HTML source (e.g. add or remove some part), you can
extend the theme. From version 0.16 on MkDocs implements [theme extension][3],
an easy way to override parts of a theme without forking and changing the
main theme.
[3]: http://www.mkdocs.org/user-guide/styling-your-docs/#using-the-theme_dir
### Setup and theme structure
Reference the Material theme as usual in your `mkdocs.yml`, and create a
new folder for overrides, e.g. `theme`, which you reference using `theme_dir`:
``` yaml
theme: 'material'
theme_dir: 'theme'
```
!!! warning "Theme extension prerequisites"
As the `theme_dir` variable is used for the theme extension process, the
Material theme needs to be installed via `pip` and referenced with the
`theme` parameter in your `mkdocs.yml`.
The structure in the theme directory must mirror the directory structure of the
original theme, as any file in the theme directory will replace the file with
the same name which is part of the original theme. Besides, further assets
may also be put in the theme directory.
The directory layout of the Material theme is as follows:
``` sh
.
├─ assets/
│ ├─ images/ # Images and icons
│ ├─ javascripts/ # JavaScript
│ └─ stylesheets/ # Stylesheets
├─ partials/
│ ├─ fonts.html # Webfont definitions
│ ├─ footer.html # Footer bar
│ ├─ header.html # Header bar
│ ├─ i18n.html # Localized labels
│ ├─ nav-item.html # Main navigation item
│ ├─ nav.html # Main navigation
│ ├─ search.html # Search box
│ ├─ social.html # Social links
│ ├─ source.html # Repository information
│ ├─ svgs.html # Inline SVG definitions
│ ├─ toc-item.html # Table of contents item
│ └─ toc.html # Table of contents
├─ 404.html # 404 error page
├─ base.html # Base template
└─ main.html # Default page
```
### Overriding partials
In order to override the footer, we can replace the `footer.html` partial with
our own partial. To do this, create the file `partials/footer.html` in the
theme directory. MkDocs will now use the new partial when rendering the theme.
This can be done with any file.
### Overriding template blocks
Besides overriding partials, one can also override so called template blocks,
which are defined inside the Material theme and wrap specific features. To
override a template block, create a `main.html` inside the theme directory and
define the block, e.g.:
``` jinja
{% extends "base.html" %}
{% block htmltitle %}
<title>Lorem ipsum dolor sit amet</title>
{% endblock %}
```
The Material theme provides the following template blocks:
| Block name | Wrapped contents |
| ------------ | ----------------------------------------------- |
| `analytics` | Wraps the Google Analytics integration |
| `content` | Wraps the main content |
| `extrahead` | Empty block to define additional meta tags |
| `fonts` | Wraps the webfont definitions |
| `footer` | Wraps the footer with navigation and copyright |
| `header` | Wraps the fixed header bar |
| `htmltitle` | Wraps the `<title>` tag |
| `libs` | Wraps the JavaScript libraries, e.g. Modernizr |
| `repo` | Wraps the repository link in the header bar |
| `scripts` | Wraps the JavaScript application logic |
| `search_box` | Wraps the search form in the header bar |
| `site_meta` | Wraps the meta tags in the document head |
| `site_name` | Wraps the site name in the header bar |
| `site_nav` | Wraps the site navigation and table of contents |
| `social` | Wraps the social links in the footer |
| `styles` | Wraps the stylesheets (also extra sources) |
For more on this topic refer to the [MkDocs documentation][4]
[4]: http://www.mkdocs.org/user-guide/styling-your-docs/#overriding-template-blocks
## Theme development
The Material theme is built on modern technologies like ES6, [Webpack][5],
[Babel][6] and [SASS][7]. If you want to make more fundamental changes, it may
be necessary to make the adjustments directly in the source of the Material
theme and recompile it. This is fairly easy.
[5]: https://webpack.github.io/
[6]: https://babeljs.io
[7]: http://sass-lang.com
### Environment setup
In order to start development on the Material theme, a [Node.js][8] version of
at least 4 is required. Clone the repository from GitHub:
``` sh
git clone https://github.com/squidfunk/mkdocs-material
```
Then you change the directory and install all dependencies specified in the
`package.json` and `bower.json` with the following command:
Next, all dependencies need to be installed, which is done with:
``` sh
cd mkdocs-material
npm install && bower install
pip install -r requirements.txt
npm install
```
### Development
[8]: https://nodejs.org
The asset pipeline is contained in `Gulpfile.js`, which you can start with
`gulp watch`. If you specify the `--mkdocs` flag, this will also run
`mkdocs serve`, to monitor changes to the documentation. Point your browser to [localhost:8000](http://localhost:8000) and you should see this very
documentation in front of your eyes.
### Development mode
The Material theme uses a sophisticated asset pipeline using [Gulp][9] and
Webpack which can be started with the following command:
``` sh
gulp watch --mkdocs
npm run start
```
For example, changing the color palette is as simple as changing the `$primary`
and `$accent` variables in `src/assets/stylesheets/_palette.scss`:
This will also start the MkDocs development server which will monitor changes
on assets, templates and documentation. Point your browser to
[localhost:8000][10] and you should see this documentation in front of you.
For example, changing the color palette is as simple as changing the
`$md-color-primary` and `$md-color-accent` variables in
`src/assets/stylesheets/_config.scss`:
``` css
$primary: $red-400;
$accent: $teal-a700;
$md-color-primary: $clr-red-400;
$md-color-accent: $clr-teal-a700;
```
The color variables are defined by the SASS library [quantum-colors][] and
resemble all the colors contained in the material design palette.
[This page][material-colors] offers a really good overview of the palette.
!!! warning "Automatically generated files"
### Building
Never make any changes in the `material` directory, as the contents of this
directory are automatically generated from the `src` directory and will be
overriden when the theme is built.
[9]: http://gulpjs.com
[10]: http://localhost:8000
### Build process
When you finished making your changes, you can build the theme by invoking:
``` sh
gulp build --production
npm run build
```
The `--production` flag triggers the production-level compilation and
minification of all CSS and Javascript sources. When the command is ready,
the final theme is located in the `material` directory. Add the `theme_dir`
variable pointing to the aforementioned directory in your original
`mkdocs.yml`:
``` yaml
theme_dir: 'mkdocs-material/material'
```
This triggers the production-level compilation and minification of all
stylesheets and JavaScript sources. When the command is ready, the final
theme is located in the `material` directory. Add the `theme_dir` variable
pointing to the aforementioned directory in your original `mkdocs.yml`.
Now you can run `mkdocs build` and you should see your documentation with your
changes to the original Material theme.
[MkDocs]: http://www.mkdocs.org
[MkDocs documentation]: http://www.mkdocs.org/user-guide/styling-your-docs/#customising-a-theme
[quantum-colors]: https://github.com/nkpfstr/quantum-colors
[material-colors]: http://www.materialui.co/colors

View File

@ -0,0 +1,333 @@
# Admonition
[Admonition][1] is an extension included in the standard Markdown library that
makes it possible to add block-styled side content to your documentation, for
example summaries, notes, hints or warnings.
[1]: https://pythonhosted.org/Markdown/extensions/admonition.html
## Installation
Add the following lines to your `mkdocs.yml`:
``` yaml
markdown_extensions:
- admonition
```
## Usage
Admonition blocks follow a simple syntax: every block is started with `!!!`,
followed by a single keyword which is used as the [type qualifier][2] of the
block. The content of the block then follows on the next line, indented by
four spaces.
Example:
``` markdown
!!! note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
[2]: #types
### Changing the title
By default, the block title will equal the type qualifier in titlecase. However,
it can easily be changed by adding a quoted string after the type qualifier.
Example:
``` markdown
!!! note "Phasellus posuere in sem ut cursus"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! note "Phasellus posuere in sem ut cursus"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
### Removing the title
Similar to setting a [custom title][3], the icon and title can be omitted by
providing an empty string after the type qualifier:
Example:
``` markdown
!!! note ""
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! note ""
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
[3]: #changing-the-title
### Embedded code blocks
Blocks can contain all kinds of text content, including headlines, lists,
paragraphs and other blocks except code blocks, because the parser from the
standard Markdown library does not account for those.
However, the [PyMdown Extensions][4] package adds an extension called
[SuperFences][5], which makes it possible to nest code blocks within other
blocks.
[4]: https://facelessuser.github.io/pymdown-extensions
[5]: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/
Example:
!!! note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
``` mysql
SELECT
Employees.EmployeeID,
Employees.Name,
Employees.Salary,
Manager.Name AS Manager
FROM
Employees
LEFT JOIN
Employees AS Manager
ON
Employees.ManagerID = Manager.EmployeeID
WHERE
Employees.EmployeeID = '087652';
```
Nunc eu odio eleifend, blandit leo a, volutpat sapien. Phasellus posuere in
sem ut cursus. Nullam sit amet tincidunt ipsum, sit amet elementum turpis.
Etiam ipsum quam, mattis in purus vitae, lacinia fermentum enim.
## Types
Admonition supports user-defined type qualifiers which may influence the style
of the inserted block. Following is a list of type qualifiers supported by the
Material theme, whereas the default type, and thus fallback for unknown type
qualifiers, is [note][6].
[6]: #note
### Note
Example:
``` markdown
!!! note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! note
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `note`
* `seealso`
### Summary
Example:
``` markdown
!!! summary
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! summary
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `summary`
* `tldr`
### Tip
Example:
``` markdown
!!! tip
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! tip
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `tip`
* `hint`
* `important`
### Success
Example:
``` markdown
!!! success
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! success
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `success`
* `check`
* `done`
### Warning
Example:
``` markdown
!!! warning
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! warning
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `warning`
* `caution`
* `attention`
### Failure
Example:
``` markdown
!!! failure
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! failure
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `failure`
* `fail`
* `missing`
### Danger
Example:
``` markdown
!!! danger
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! danger
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `danger`
* `error`
### Bug
Example:
``` markdown
!!! bug
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
!!! bug
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
Qualifiers:
* `bug`

View File

@ -0,0 +1,855 @@
# CodeHilite
[CodeHilite][1] is an extension that adds syntax highlighting to code blocks
and is included in the standard Markdown library. The highlighting process is
executed during compilation of the Markdown file.
[1]: https://pythonhosted.org/Markdown/extensions/code_hilite.html
## Installation
CodeHilite parses code blocks and wraps them in `<pre>` tags. If [Pygments][2]
is installed, which is a generic syntax highlighter with support for over
[300 languages][3], CodeHilite will also highlight the code block. Pygments can
be installed with the following command:
``` sh
pip install pygments
```
To enable CodeHilite, add the following lines to your `mkdocs.yml`:
``` yaml
markdown_extensions:
- codehilite
```
!!! warning "Migrating from Material 0.2.x"
In 0.2.x the CodeHilite extension was included with
`codehilite(css_class=code)` which switched the CSS class from
`.codehilite` to `.code`. The current version of the theme doesn't require
that and defines styles for the default `.codehilite` class, so the part
`css_class=code` needs to be removed.
[2]: http://pygments.org
[3]: http://pygments.org/languages
## Usage
### Specifying the language
The CodeHilite extension uses the same syntax as regular Markdown code blocks,
but needs to know the language of the code block. This can be done in three
different ways.
#### via Markdown syntax <small>recommended</small>
In Markdown, code blocks can be opened and closed by writing three backticks on
separate lines. To add code highlighting to those blocks, the easiest way is
to specify the language directly after the opening block.
Example:
```` markdown
``` python
import tensorflow as tf
```
````
Result:
``` python
import tensorflow as tf
```
#### via Shebang
Alternatively, if the first line of a code block contains a shebang, the
language is derived from the path referenced in the shebang. This will only
work for code blocks that are indented using four spaces, not for those
encapsulated in three backticks.
Example:
```` markdown
#!/usr/bin/python
import tensorflow as tf
````
Result:
``` python
#!/usr/bin/python
import tensorflow as tf
```
#### via three colons
If the first line starts with three colons followed by a language identifier,
the first line is stripped. This will only work for code blocks that are
indented using four spaces, not for those encapsulated in three backticks.
Example:
``` markdown
:::python
import tensorflow as tf
```
Result:
:::python
import tensorflow as tf
### Adding line numbers
Line numbers can be added by enabling the `linenums` flag in your `mkdocs.yml`:
``` yaml
markdown_extensions:
- codehilite(linenums=true)
```
Example:
```` markdown
``` python
""" Bubble sort """
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
```
````
Result:
#!python
""" Bubble sort """
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
### Highlighting specific lines
Specific lines can be highlighted by passing the line numbers to the `hl_lines`
argument placed right after the language identifier. Line counts start at 1.
Example:
```` markdown
``` python hl_lines="3 4"
""" Bubble sort """
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
```
````
Result:
#!python hl_lines="3 4"
""" Bubble sort """
def bubble_sort(items):
for i in range(len(items)):
for j in range(len(items) - 1 - i):
if items[j] > items[j + 1]:
items[j], items[j + 1] = items[j + 1], items[j]
## Supported languages <small>excerpt</small>
CodeHilite uses [Pygments][2], a generic syntax highlighter with support for
over [300 languages][3], so the following list of examples is just an excerpt.
### Bash
``` bash
#!/bin/bash
for OPT in "$@"
do
case "$OPT" in
'-f' ) canonicalize=1 ;;
'-n' ) switchlf="-n" ;;
esac
done
# readlink -f
function __readlink_f {
target="$1"
while test -n "$target"; do
filepath="$target"
cd `dirname "$filepath"`
target=`readlink "$filepath"`
done
/bin/echo $switchlf `pwd -P`/`basename "$filepath"`
}
if [ ! "$canonicalize" ]; then
readlink $switchlf "$@"
else
for file in "$@"
do
case "$file" in
-* ) ;;
* ) __readlink_f "$file" ;;
esac
done
fi
exit $?
```
### C
``` c
extern size_t
pb_varint_scan(const uint8_t data[], size_t left) {
assert(data && left);
left = left > 10 ? 10 : left;
#ifdef __SSE2__
/* Mapping: remaining bytes ==> bitmask */
static const int mask_map[] = {
0x0000, 0x0001, 0x0003, 0x0007,
0x000F, 0x001F, 0x003F, 0x007F,
0x00FF, 0x01FF, 0x03FF
};
/* Load buffer into 128-bit integer and create high-bit mask */
__m128i temp = _mm_loadu_si128((const __m128i *)data);
__m128i high = _mm_set1_epi8(0x80);
/* Intersect and extract mask with high-bits set */
int mask = _mm_movemask_epi8(_mm_and_si128(temp, high));
mask = (mask & mask_map[left]) ^ mask_map[left];
/* Count trailing zeroes */
return mask ? __builtin_ctz(mask) + 1 : 0;
#else
/* Linear scan */
size_t size = 0;
while (data[size++] & 0x80)
if (!--left)
return 0;
return size;
#endif /* __SSE2__ */
}
```
### C++
``` cpp
Extension::
Extension(const Descriptor *descriptor, const Descriptor *scope) :
descriptor_(descriptor),
scope_(scope) {
/* Extract full name for signature */
variables_["signature"] = descriptor_->full_name();
/* Prepare message symbol */
variables_["message"] = StringReplace(
variables_["signature"], ".", "_", true);
LowerString(&(variables_["message"]));
/* Suffix scope to identifiers, if given */
string suffix ("");
if (scope_) {
suffix = scope_->full_name();
/* Check if the base and extension types are in the same package */
if (!scope_->file()->package().compare(descriptor_->file()->package()))
suffix = StripPrefixString(suffix,
scope_->file()->package() + ".");
/* Append to signature */
variables_["signature"] += ".[" + suffix +"]";
suffix = "_" + suffix;
}
/* Prepare extension symbol */
variables_["extension"] = StringReplace(
suffix, ".", "_", true);
LowerString(&(variables_["extension"]));
}
```
### C&#35;
``` csharp
public static void Send(
Socket socket, byte[] buffer, int offset, int size, int timeout) {
int startTickCount = Environment.TickCount;
int sent = 0;
do {
if (Environment.TickCount > startTickCount + timeout)
throw new Exception("Timeout.");
try {
sent += socket.Send(buffer, offset + sent,
size - sent, SocketFlags.None);
} catch (SocketException ex) {
if (ex.SocketErrorCode == SocketError.WouldBlock ||
ex.SocketErrorCode == SocketError.IOPending ||
ex.SocketErrorCode == SocketError.NoBufferSpaceAvailable) {
/* Socket buffer is probably full, wait and try again */
Thread.Sleep(30);
} else {
throw ex;
}
}
} while (sent < size);
}
```
### Clojure
``` clojure
(clojure-version)
(defn partition-when
[f]
(fn [rf]
(let [a (java.util.ArrayList.)
fval (volatile! false)]
(fn
([] (rf))
([result]
(let [result (if (.isEmpty a)
result
(let [v (vec (.toArray a))]
;; Clear first
(.clear a)
(unreduced (rf result v))))]
(rf result)))
([result input]
(if-not (and (f input) @fval)
(do
(vreset! fval true)
(.add a input)
result)
(let [v (vec (.toArray a))]
(.clear a)
(let [ret (rf result v)]
(when-not (reduced? ret)
(.add a input))
ret))))))))
(into [] (partition-when
#(.startsWith % ">>"))
["1d" "33" ">> 1" ">> 2" "22" ">> 3"])
```
### Diff
``` diff
Index: grunt.js
===================================================================
--- grunt.js (revision 31200)
+++ grunt.js (working copy)
@@ -12,6 +12,7 @@
module.exports = function (grunt) {
+ console.log('hello world');
// Project configuration.
grunt.initConfig({
lint: {
@@ -19,10 +20,6 @@
'packages/services.web/{!(test)/**/,}*.js',
'packages/error/**/*.js'
],
- scripts: [
- 'grunt.js',
- 'db/**/*.js'
- ],
browser: [
'packages/web/server.js',
'packages/web/server/**/*.js',
```
### Docker
``` docker
FROM ubuntu
# Install vnc, xvfb in order to create a 'fake' display and firefox
RUN apt-get update && apt-get install -y x11vnc xvfb firefox
RUN mkdir ~/.vnc
# Setup a password
RUN x11vnc -storepasswd 1234 ~/.vnc/passwd
# Autostart firefox (might not be the best way, but it does the trick)
RUN bash -c 'echo "firefox" >> /.bashrc'
EXPOSE 5900
CMD ["x11vnc", "-forever", "-usepw", "-create"]
```
### Elixir
``` elixir
require Logger
def accept(port) do
{:ok, socket} = :gen_tcp.listen(port,
[:binary, packet: :line, active: false, reuseaddr: true])
Logger.info "Accepting connections on port #{port}"
loop_acceptor(socket)
end
defp loop_acceptor(socket) do
{:ok, client} = :gen_tcp.accept(socket)
serve(client)
loop_acceptor(socket)
end
defp serve(socket) do
socket
|> read_line()
|> write_line(socket)
serve(socket)
end
defp read_line(socket) do
{:ok, data} = :gen_tcp.recv(socket, 0)
data
end
defp write_line(line, socket) do
:gen_tcp.send(socket, line)
end
```
### Erlang
``` erlang
circular(Defs) ->
[ { { Type, Base }, Fields } ||
{ { Type, Base }, Fields } <- Defs, Type == msg, circular(Base, Defs) ].
circular(Base, Defs) ->
Fields = proplists:get_value({ msg, Base }, Defs),
circular(Defs, Fields, [Base]).
circular(_Defs, [], _Path) ->
false;
circular(Defs, [Field | Fields], Path) ->
case Field#field.type of
{ msg, Type } ->
case lists:member(Type, Path) of
false ->
Children = proplists:get_value({ msg, Type }, Defs),
case circular(Defs, Children, [Type | Path]) of
false -> circular(Defs, Fields, Path);
true -> true
end;
true ->
Type == lists:last(Path) andalso
(length(Path) == 1 orelse not is_tree(Path))
end;
_ ->
circular(Defs, Fields, Path)
end.
```
### F&#35;
``` fsharp
/// Asynchronously download retangles from the server
/// and decode the JSON format to F# Rectangle record
let [<Js>] getRectangles () : Async<Rectangle[]> = async {
let req = XMLHttpRequest()
req.Open("POST", "/get", true)
let! resp = req.AsyncSend()
return JSON.parse(resp) }
/// Repeatedly update rectangles after 0.5 sec
let [<Js>] updateLoop () = async {
while true do
do! Async.Sleep(500)
let! rects = getRectangles()
cleanRectangles()
rects |> Array.iter createRectangle }
```
### Go
``` go
package main
import "fmt"
func counter(id int, channel chan int, closer bool) {
for i := 0; i < 10000000; i++ {
fmt.Println("process", id," send", i)
channel <- 1
}
if closer { close(channel ) }
}
func main() {
channel := make(chan int)
go counter(1, channel, false)
go counter(2, channel, true)
x := 0
// receiving data from channel
for i := range channel {
fmt.Println("receiving")
x += i
}
fmt.Println(x)
}
```
### HTML
``` html
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>HTML5 Boilerplate</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-touch-icon.png">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<script src="js/vendor/modernizr-2.8.3.min.js"></script>
</head>
<body>
<p>Hello world! This is HTML5 Boilerplate.</p>
</body>
</html>
```
### Java
``` java
import java.util.LinkedList;
import java.lang.reflect.Array;
public class UnsortedHashSet<E> {
private static final double LOAD_FACTOR_LIMIT = 0.7;
private int size;
private LinkedList<E>[] con;
public UnsortedHashSet() {
con = (LinkedList<E>[])(new LinkedList[10]);
}
public boolean add(E obj) {
int oldSize = size;
int index = Math.abs(obj.hashCode()) % con.length;
if (con[index] == null)
con[index] = new LinkedList<E>();
if (!con[index].contains(obj)) {
con[index].add(obj);
size++;
}
if (1.0 * size / con.length > LOAD_FACTOR_LIMIT)
resize();
return oldSize != size;
}
private void resize() {
UnsortedHashSet<E> temp = new UnsortedHashSet<E>();
temp.con = (LinkedList<E>[])(new LinkedList[con.length * 2 + 1]);
for (int i = 0; i < con.length; i++) {
if (con[i] != null)
for (E e : con[i])
temp.add(e);
}
con = temp.con;
}
public int size() {
return size;
}
}
```
### JavaScript
``` javascript
var Math = require('lib/math');
var _extends = function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target;
};
var e = exports.e = 2.71828182846;
exports['default'] = function (x) {
return Math.exp(x);
};
module.exports = _extends(exports['default'], exports);
```
### JSON
``` json
{
"name": "mkdocs-material",
"version": "0.2.4",
"description": "A Material Design theme for MkDocs",
"homepage": "http://squidfunk.github.io/mkdocs-material/",
"authors": [
"squidfunk <martin.donath@squidfunk.com>"
],
"license": "MIT",
"main": "Gulpfile.js",
"scripts": {
"start": "./node_modules/.bin/gulp watch --mkdocs",
"build": "./node_modules/.bin/gulp build --production"
}
...
}
```
### Julia
``` julia
using MXNet
mlp = @mx.chain mx.Variable(:data) =>
mx.FullyConnected(name=:fc1, num_hidden=128) =>
mx.Activation(name=:relu1, act_type=:relu) =>
mx.FullyConnected(name=:fc2, num_hidden=64) =>
mx.Activation(name=:relu2, act_type=:relu) =>
mx.FullyConnected(name=:fc3, num_hidden=10) =>
mx.SoftmaxOutput(name=:softmax)
# data provider
batch_size = 100
include(Pkg.dir("MXNet", "examples", "mnist", "mnist-data.jl"))
train_provider, eval_provider = get_mnist_providers(batch_size)
# setup model
model = mx.FeedForward(mlp, context=mx.cpu())
# optimization algorithm
optimizer = mx.SGD(lr=0.1, momentum=0.9)
# fit parameters
mx.fit(model, optimizer, train_provider, n_epoch=20, eval_data=eval_provider)
```
### Lua
``` lua
local ffi = require("ffi")
ffi.cdef[[
void Sleep(int ms);
int poll(struct pollfd *fds, unsigned long nfds, int timeout);
]]
local sleep
if ffi.os == "Windows" then
function sleep(s)
ffi.C.Sleep(s*1000)
end
else
function sleep(s)
ffi.C.poll(nil, 0, s * 1000)
end
end
for i = 1,160 do
io.write("."); io.flush()
sleep(0.01)
end
io.write("\n")
```
### MySQL
``` mysql
SELECT
Employees.EmployeeID,
Employees.Name,
Employees.Salary,
Manager.Name AS Manager
FROM
Employees
LEFT JOIN
Employees AS Manager
ON
Employees.ManagerID = Manager.EmployeeID
WHERE
Employees.EmployeeID = '087652';
```
### PHP
``` php
<?php
// src/AppBundle/Controller/LuckyController.php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;
class LuckyController {
/**
* @Route("/lucky/number")
*/
public function numberAction() {
$number = mt_rand(0, 100);
return new Response(
'<html><body>Lucky number: '.$number.'</body></html>'
);
}
}
```
### Protocol Buffers
``` proto
syntax = "proto2";
package caffe;
// Specifies the shape (dimensions) of a Blob.
message BlobShape {
repeated int64 dim = 1 [packed = true];
}
message BlobProto {
optional BlobShape shape = 7;
repeated float data = 5 [packed = true];
repeated float diff = 6 [packed = true];
// 4D dimensions -- deprecated. Use "shape" instead.
optional int32 num = 1 [default = 0];
optional int32 channels = 2 [default = 0];
optional int32 height = 3 [default = 0];
optional int32 width = 4 [default = 0];
}
```
### Python
``` python
"""
A very simple MNIST classifier.
See extensive documentation at
http://tensorflow.org/tutorials/mnist/beginners/index.md
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Import data
from tensorflow.examples.tutorials.mnist import input_data
import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_string('data_dir', '/tmp/data/', 'Directory for storing data')
mnist = input_data.read_data_sets(FLAGS.data_dir, one_hot=True)
sess = tf.InteractiveSession()
# Create the model
x = tf.placeholder(tf.float32, [None, 784])
W = tf.Variable(tf.zeros([784, 10]))
b = tf.Variable(tf.zeros([10]))
y = tf.nn.softmax(tf.matmul(x, W) + b)
```
### Ruby
``` ruby
require 'finity/event'
require 'finity/machine'
require 'finity/state'
require 'finity/transition'
require 'finity/version'
module Finity
class InvalidCallback < StandardError; end
class MissingCallback < StandardError; end
class InvalidState < StandardError; end
# Class methods to be injected into the including class upon inclusion.
module ClassMethods
# Instantiate a new state machine for the including class by accepting a
# block with state and event (and subsequent transition) definitions.
def finity options = {}, &block
@finity ||= Machine.new self, options, &block
end
# Return the names of all registered states.
def states
@finity.states.map { |name, _| name }
end
# Return the names of all registered events.
def events
@finity.events.map { |name, _| name }
end
end
# Inject methods into the including class upon inclusion.
def self.included base
base.extend ClassMethods
end
end
```
### XML
``` xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mainTag SYSTEM "some.dtd" [ENTITY % entity]>
<?oxygen RNGSchema="some.rng" type="xml"?>
<xs:main-Tag xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- This is a sample comment -->
<childTag attribute="Quoted Value" another-attribute='Single quoted value'
a-third-attribute='123'>
<withTextContent>Some text content</withTextContent>
<withEntityContent>Some text content with &lt;entities&gt; and
mentioning uint8_t and int32_t</withEntityContent>
<otherTag attribute='Single quoted Value'/>
</childTag>
<![CDATA[ some CData ]]>
</main-Tag>
```

View File

@ -0,0 +1,84 @@
# Footnotes
[Footnotes][1] is another extension included in the standard Markdown library.
As the name says, it adds the ability to add footnotes to your documentation.
[1]: https://pythonhosted.org/Markdown/extensions/footnotes.html
## Installation
Add the following lines to your `mkdocs.yml`:
``` yaml
markdown_extensions:
- footnotes
```
## Usage
The markup for footnotes is similar to the standard Markdown markup for links.
A reference is inserted in the text, which can then be defined at any point in
the document.
### Inserting the reference
The footnote reference is enclosed in square brackets and starts with a caret,
followed by an arbitrary label which may contain numeric identifiers [1, 2, 3,
...] or names [Granovetter et al. 1998]. The rendered references are always
consecutive superscripted numbers.
Example:
``` markdown
Lorem ipsum[^1] dolor sit amet, consectetur adipiscing elit.[^2]
```
Result:
Lorem ipsum[^1] dolor sit amet, consectetur adipiscing elit.[^2]
### Inserting the content
The footnote content is also declared with a label, which must match the label
used for the footnote reference. It can be inserted at an arbitrary position in
the document and is always rendered at the bottom of the page. Furthermore, a
backlink is automatically added to the footnote reference.
#### on a single line
Short statements can be written on the same line.
Example:
``` markdown
[^1]: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
```
Result:
<a href="#fn:1">Jump to footnote at the bottom of the page</a>
[^1]: Lorem ipsum dolor sit amet, consectetur adipiscing elit.
#### on multiple lines
Paragraphs should be written on the next line. As with all Markdown blocks, the
content must be indented by four spaces.
Example:
``` markdown
[^2]:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor
massa, nec semper lorem quam in massa.
```
Result:
[^2]:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod
nulla. Curabitur feugiat, tortor non consequat finibus, justo purus
auctor massa, nec semper lorem quam in massa.
<a href="#fn:2">Jump to footnote at the bottom of the page</a>

View File

@ -0,0 +1,31 @@
# Permalinks
Permalinks are a feature of the [Table of Contents][1] extension, which is part
of the standard Markdown library. The extension inserts an anchor at the end of
each headline, which makes it possible to directly link to a subpart of the
document.
[1]: https://pythonhosted.org/Markdown/extensions/toc.html
## Installation
To enable permalinks, add the following to your `mkdocs.yml`:
``` yaml
markdown_extensions:
- toc(permalink=true)
```
This will add a link containing the paragraph symbol `¶` at the end of each
headline (exactly like on the page you're currently viewing), which the
Material theme will make appear on hover. In order to change the text of the
permalink, a string can be passed, e.g.:
``` markdown
markdown_extensions:
- toc(permalink=Link)
```
## Usage
When enabled, permalinks are inserted automatically.

284
docs/extensions/pymdown.md Normal file
View File

@ -0,0 +1,284 @@
# PyMdown Extensions
[PyMdown Extensions][1] is a collection of Markdown extensions that add some
great features to the standard Markdown library. For this reason, the
**installation of this package is highly recommended** as it's well-integrated
with the Material theme.
[1]: http://facelessuser.github.io/pymdown-extensions/
## Installation
The PyMdown Extensions package can be installed with the following command:
``` sh
pip install pymdown-extensions
```
The following list of extensions that are part of the PyMdown Extensions
package are recommended to be used together with the Material theme:
``` yaml
markdown_extensions:
- pymdownx.arithmatex
- pymdownx.betterem(smart_enable=all)
- pymdownx.caret
- pymdownx.critic
- pymdownx.emoji:
emoji_generator: !!python/name:pymdownx.emoji.to_svg
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tasklist(custom_checkbox=true)
- pymdownx.tilde
```
## Usage
### GitHub Flavored Markdown
Most of the extensions included in the PyMdown Extensions package try to bring
the Markdown experience closer to GitHub Flavored Markdown (GFM).
The PyMdown Extensions package adds a shorthand to enable all of the included
extensions that provide the GFM experience. However, usage of the shorthand is
discouraged, because some extensions are not supported, as the Material theme
uses some incompatible extensions included in the standard Markdown library.
#### BetterEm
[BetterEm][2] improves the handling of emphasis markup (**bold** and *italic*)
within Markdown by providing a more sophisticated parser for better detecting
start and end tokens. Read the documentation for [usage notes][3].
[2]: https://facelessuser.github.io/pymdown-extensions/extensions/betterem/
[3]: https://facelessuser.github.io/pymdown-extensions/usage_notes/
#### Emoji
[Emoji][4] adds the ability to insert a :shit:-load of emojis that we use in
our daily lives. See the [EmojiOne demo][5] for a list of all available
emojis. Happy scrolling :tada:
!!! warning "Legal disclaimer"
Material has no affiliation with [EmojiOne][6] which is released under
[CC BY 4.0][7]. When including EmojiOne images or CSS, please read the
[EmojiOne license][8] to ensure proper usage and attribution.
[4]: https://facelessuser.github.io/pymdown-extensions/extensions/emoji/
[5]: http://emojione.com/demo/
[6]: http://emojione.com
[7]: https://creativecommons.org/licenses/by/4.0/legalcode
[8]: http://emojione.com/licensing/
#### MagicLink
[MagicLink][9] detects links in Markdown and auto-generates the necessary
markup, so no special syntax is required. It auto-links `http[s]://` and
`ftp://` links, as well as references to email addresses:
[9]: https://facelessuser.github.io/pymdown-extensions/extensions/magiclink/
#### SuperFences
[SuperFences][10] provides the ability to nest code blocks under blockquotes,
lists and other block elements, which the [Fenced Code Blocks][11] extension
from the standard Markdown library doesn't parse correctly.
[10]: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/
[11]: https://pythonhosted.org/Markdown/extensions/fenced_code_blocks.html
#### Tasklist
[Tasklist][12] adds support for styled checkbox lists. This is useful for
keeping track of tasks and showing what has been done and has yet to be done.
Checkbox lists are like regular lists, but prefixed with `[ ]` for empty or
`[x]` for filled checkboxes.
Example:
``` markdown
* [x] Lorem ipsum dolor sit amet, consectetur adipiscing elit
* [x] Nulla lobortis egestas semper
* [x] Curabitur elit nibh, euismod et ullamcorper at, iaculis feugiat est
* [ ] Vestibulum convallis sit amet nisi a tincidunt
* [x] In hac habitasse platea dictumst
* [x] In scelerisque nibh non dolor mollis congue sed et metus
* [x] Sed egestas felis quis elit dapibus, ac aliquet turpis mattis
* [ ] Praesent sed risus massa
* [ ] Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
* [ ] Nulla vel eros venenatis, imperdiet enim id, faucibus nisi
```
Result:
* [x] Lorem ipsum dolor sit amet, consectetur adipiscing elit
* [x] Nulla lobortis egestas semper
* [x] Curabitur elit nibh, euismod et ullamcorper at, iaculis feugiat est
* [ ] Vestibulum convallis sit amet nisi a tincidunt
* [x] In hac habitasse platea dictumst
* [x] In scelerisque nibh non dolor mollis congue sed et metus
* [x] Sed egestas felis quis elit dapibus, ac aliquet turpis mattis
* [ ] Praesent sed risus massa
* [ ] Aenean pretium efficitur erat, donec pharetra, ligula non scelerisque
* [ ] Nulla vel eros venenatis, imperdiet enim id, faucibus nisi
[12]: https://facelessuser.github.io/pymdown-extensions/extensions/tasklist/
#### Tilde
[Tilde][13] provides an easy way to ~~strike through~~ cross out text.
The portion of text that should be erased must be enclosed in two tildes
`~~...~~` and the extension will take care of the rest.
[13]: https://facelessuser.github.io/pymdown-extensions/extensions/tilde/
### More syntactic sugar
#### Caret
[Caret][14] is the sister extension of [Tilde][15] and makes it possible to
highlight ^^inserted text^^. The portion of text that should be marked as added
must be enclosed in two carets `^^...^^`.
[14]: https://facelessuser.github.io/pymdown-extensions/extensions/caret/
[15]: #tilde
#### Mark
[Mark][16] adds the ability to ==highlight text== like it was marked with a
==yellow text marker==. The portion of text that should be highlighted must be
enclosed in two equal signs `==...==`.
[16]: https://facelessuser.github.io/pymdown-extensions/extensions/mark/
#### SmartSymbols
[SmartSymbols][17] converts markup for special characters into their
corresponding symbols, e.g. arrows (<--, -->, <-->), trademark and copyright
symbols ((c), (tm), (r)) and fractions (1/2, 1/4, ...).
[17]: https://facelessuser.github.io/pymdown-extensions/extensions/smartsymbols/
#### Critic
[Critic][18] implements [Critic Markup][19], a Markdown extension that enables
the tracking of changes (additions, deletions and comments) on documents.
During compilation of the Markdown document, changes can be rendered (default),
accepted or rejected.
Text can be {--deleted--} and replacement text {++added++}. This can also be
combined into {~~one~>a single~~} operation. {==Highlighting==} is also
possible {>>and comments can be added inline<<}.
{==
Formatting can also be applied to blocks, by putting the opening and closing
tags on separate lines and adding new lines between the tags and the content.
==}
[18]: https://facelessuser.github.io/pymdown-extensions/extensions/critic/
[19]: http://criticmarkup.com/
### Arithmatex <small>MathJax</small>
<script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"></script>
[Arithmatex][20] integrates Material with [MathJax][21] which parses
block-style and inline equations written in TeX markup and outputs them in
mathematical notation. See [this thread][22] for a short introduction and quick
reference on how to write equations in TeX syntax.
Besides activating the extension in the `mkdocs.yml`, the MathJax JavaScript
runtime needs to be included. This must be done with
[additional JavaScript][23]:
``` yaml
extra_javascript:
- 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML'
```
If you want to override the default MathJax configuration, you can do this by
adding another JavaScript file **before** the MathJax runtime in
`extra_javascript` which contains your MathJax configuration, e.g.:
``` js
window.MathJax = {
tex2jax: {
inlineMath: [ ["\\(","\\)"] ],
displayMath: [ ["\\[","\\]"] ]
},
TeX: {
TagSide: "right",
TagIndent: ".8em",
MultLineWidth: "85%",
equationNumbers: {
autoNumber: "AMS",
},
unicode: {
fonts: "STIXGeneral,'Arial Unicode MS'"
}
},
displayAlign: "left",
showProcessingMessages: false,
messageStyle: "none"
};
```
In your `mkdocs.yml`, include it with:
``` yaml
extra_javascript:
- 'javascripts/extra.js'
- 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML'
```
[20]: https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/
[21]: https://www.mathjax.org/
[22]: http://meta.math.stackexchange.com/questions/5020/
[23]: ../customization.md#additional-javascript
#### Blocks
Blocks are enclosed in `:::tex $$...$$` which are placed on separate lines.
Example:
``` tex
$$
\frac{n!}{k!(n-k)!} = \binom{n}{k}
$$
```
Result:
$$
\frac{n!}{k!(n-k)!} = \binom{n}{k}
$$
#### Inline
Inline equations need to be enclosed in `:::tex $...$`:
Example:
``` tex
Lorem ipsum dolor sit amet: $p(x|y) = \frac{p(y|x)p(x)}{p(y)}$
```
Result:
Lorem ipsum dolor sit amet: $p(x|y) = \frac{p(y|x)p(x)}{p(y)}$
### InlineHilite
[InlineHilite][24] adds support for inline code highlighting. It's useful for
short snippets included within body copy, e.g. `#!js var test = 0;` and can be
achived by prefixing inline code with a shebang and language identifier,
e.g. `#!js`.
[24]: https://facelessuser.github.io/pymdown-extensions/extensions/inlinehilite/

View File

@ -4,130 +4,117 @@
### Installing MkDocs
Before installing [MkDocs][], you need to make sure you have Python and `pip`
the Python package manager up and running. Assuming you are a developer and
have a basic understanding of how things work and what StackOverflow is, we
won't provide guidelines on setting those up. You can verify if you're already
Before installing [MkDocs][2], you need to make sure you have Python and `pip`
the Python package manager up and running. You can verify if you're already
good to go with the following commands:
``` sh
python --version
# Python 2.7.2
# Python 2.7.13
pip --version
# pip 1.5.2
# pip 9.0.1
```
Installing and verifying MkDocs is as simple as:
``` sh
pip install mkdocs && mkdocs --version
# mkdocs, version 0.15.2
# mkdocs, version 0.16.0
```
!!! warning "MkDocs for Material requirements"
Material requires MkDocs >= 0.16.
Furthermore, it is highly recommended to install [Pygments][3] and the
[PyMdown Extensions][4] to get the most out of the Material theme:
```sh
pip install pygments
pip install pymdown-extensions
```
[1]: https://hub.docker.com/r/squidfunk/mkdocs-material/
[2]: http://www.mkdocs.org
[3]: http://pygments.org
[4]: http://facelessuser.github.io/pymdown-extensions/
### Installing Material
Next, assuming you have MkDocs up and running `mkdocs-material` can be
installed with `pip`:
#### by using pip
Material can be installed with `pip`:
``` sh
pip install mkdocs-material
```
## Usage
!!! warning "Installation on macOS"
If you haven't already done it, creating a new documentation project is really
simple in MkDocs:
When you're running the pre-installed version of Python on macOS, `pip`
tries to install packages in a folder for which your user might not have
the adequate permissions. There are two possible solutions to this:
1. **Installing in user space** (recommended): Provide the `--user` flag
to the install command and `pip` will install the package in a user-site
location. This is the recommended way.
2. **Switching to a homebrewed Python**: Upgrade your Python installation
to a self-contained solution by installing Python with Homebrew. This
should eliminate a lot of problems you may be having with `pip`.
#### by cloning from GitHub
Material can also be used without a system-wide installation by cloning the
repository into a subfolder of your project's root directory:
``` sh
mkdocs new my-project
cd my-project
git clone https://github.com/squidfunk/mkdocs-material.git
```
MkDocs will create the necessary files and base directory structure inside the
folder `my-project`. In order to enable the theme just add the following line
to the auto-generated `mkdocs.yml`:
This is especially useful if you want to extend the theme and override some
parts of the theme. The theme will reside in the folder
`mkdocs-material/material`.
## Usage
In order to enable the Material theme just add one of the following lines to
your `mkdocs.yml`. If you installed Material using pip:
``` yaml
theme: 'material'
```
If your project is hosted on GitHub, add the repository link to the
configuration. If the `repo_name` equals **GitHub**, the Material theme will
add a download and star button, and display the number of stars:
If you cloned Material from GitHub:
``` yaml
repo_name: 'GitHub'
repo_url: 'https://github.com/my-github-handle/my-project'
theme_dir: 'mkdocs-material/material'
```
MkDocs includes a development server, so you can view your changes as you go -
very handy. Spin it up with the following command:
MkDocs includes a development server, so you can view your changes as you go.
The development server can be started with the following command:
``` sh
mkdocs serve
```
Now you can go to [localhost:8000](http://localhost:8000) and the Material
theme should be visible. You can now start writing your documentation, or read
on and customize the theme through some options.
Now you can point your browser to [localhost:8000][5] and the Material theme
should be visible. From here on, you can start writing your documentation, or
read on and customize the theme through some options.
[5]: http://localhost:8000
## Options
The Material theme adds some extra variables for configuration via your
project's `mkdocs.yml`. See the following section for all available options.
### Adding a version
In order to add the current version next to the project banner inside the
drawer, you can set the variable `extra.version`:
``` yaml
extra:
version: '0.1.0'
```
This will also change the link behind the download button to point to the
archive with the respective version on GitHub, assuming a release tagged with
this exact version identifier.
### Adding a logo
If your project has a logo, you can add it to the drawer/navigation by defining
the variable `extra.logo`. Ideally, the image of your logo should have
rectangular shape with a minimum resolution of 128x128 and leave some room
towards the edges. The logo will also be used as a web application icon on iOS.
Simply create the folder `docs/images`, add your image and reference it via:
``` yaml
extra:
logo: 'images/logo.png'
```
### Link to GitHub releases page
If your project has a GitHub url configured, the default behavior is that a
downlink button is displayed, linking to the source download of the given
`extra.version` or `master` branch. To link to the releases page instead,
set `extra.github.download_release` to `true`. It will link to the release of
the given `extra.version` or when no `extra.version` is given, the latest
release:
``` yaml
repo_name: GitHub
repo_url: https://github.com/squidfunk/mkdocs-material
extra:
github:
download_release: true
```
### Changing the color palette
Material defines a default hue for every primary and accent color on Google's
material design [color palette][]. This makes it very easy to change the
overall look of the theme. Just set the variables `extra.palette.primary` and
`extra.palette.accent` to one of the colors defined in the palette:
Material Design [color palette][6]. This makes it very easy to change the
overall look of the theme. Just set the primary and accent colors using the
following variables in your `mkdocs.yml`:
``` yaml
extra:
@ -136,74 +123,154 @@ extra:
accent: 'light blue'
```
Color names can be written upper- or lowercase but must match the names of the
material design [color palette][]. Valid values are: _red_, _pink_, _purple_,
_deep purple_, _indigo_, _blue_, _light blue_, _cyan_, _teal_, _green_, _light
green_, _lime_, _yellow_, _amber_, _orange_, _deep orange_, _brown_, _grey_ and
_blue grey_. The last three colors can only be used as a primary color.
Color names are case-insensitive, but must match the names of the Material
Design color palette. Valid values are: `red`, `pink`, `purple`, `deep purple`,
`indigo`, `blue`, `light blue`, `cyan`, `teal`, `green`, `light green`, `lime`,
`yellow`, `amber`, `orange`, `deep orange`, `brown`, `grey` and `blue grey`.
The last three colors can only be used as a primary color.
![Material Screenshot](images/colors.png)
If the color is set via this configuration, an additional CSS file that
defines the color palette is included. If you want to keep things lean, clone
the repository and recompile the theme with your custom colors set. See the
guide on [customization][7] for more information.
If the color is set via this configuration, an additional CSS file called
`palettes.css` is included that defines the color palettes. If you want to
keep things lean, clone the repository and recompile the theme with your
custom colors set. See [this article](customization.md) for more information.
[6]: http://www.materialui.co/colors
[7]: customization.md
#### Primary colors
Click on a tile to change the primary color of the theme:
<button data-md-color-primary="red">Red</button>
<button data-md-color-primary="pink">Pink</button>
<button data-md-color-primary="purple">Purple</button>
<button data-md-color-primary="deep-purple">Deep Purple</button>
<button data-md-color-primary="indigo">Indigo</button>
<button data-md-color-primary="blue">Blue</button>
<button data-md-color-primary="light-blue">Light Blue</button>
<button data-md-color-primary="cyan">Cyan</button>
<button data-md-color-primary="teal">Teal</button>
<button data-md-color-primary="green">Green</button>
<button data-md-color-primary="light-green">Light Green</button>
<button data-md-color-primary="lime">Lime</button>
<button data-md-color-primary="yellow">Yellow</button>
<button data-md-color-primary="amber">Amber</button>
<button data-md-color-primary="orange">Orange</button>
<button data-md-color-primary="deep-orange">Deep Orange</button>
<button data-md-color-primary="brown">Brown</button>
<button data-md-color-primary="grey">Grey</button>
<button data-md-color-primary="blue-grey">Blue Grey</button>
<script>
var buttons = document.querySelectorAll("button[data-md-color-primary]");
Array.prototype.forEach.call(buttons, function(button) {
button.addEventListener("click", function() {
document.body.dataset.mdColorPrimary = this.dataset.mdColorPrimary;
})
})
</script>
#### Accent colors
Click on a tile to change the accent color of the theme:
<button data-md-color-accent="red">Red</button>
<button data-md-color-accent="pink">Pink</button>
<button data-md-color-accent="purple">Purple</button>
<button data-md-color-accent="deep-purple">Deep Purple</button>
<button data-md-color-accent="indigo">Indigo</button>
<button data-md-color-accent="blue">Blue</button>
<button data-md-color-accent="light-blue">Light Blue</button>
<button data-md-color-accent="cyan">Cyan</button>
<button data-md-color-accent="teal">Teal</button>
<button data-md-color-accent="green">Green</button>
<button data-md-color-accent="light-green">Light Green</button>
<button data-md-color-accent="lime">Lime</button>
<button data-md-color-accent="yellow">Yellow</button>
<button data-md-color-accent="amber">Amber</button>
<button data-md-color-accent="orange">Orange</button>
<button data-md-color-accent="deep-orange">Deep Orange</button>
<script>
var buttons = document.querySelectorAll("button[data-md-color-accent]");
Array.prototype.forEach.call(buttons, function(button) {
button.addEventListener("click", function() {
document.body.dataset.mdColorAccent = this.dataset.mdColorAccent;
})
})
</script>
### Changing the font family
Material uses the [Ubuntu font family][] by default, specifically the regular
sans-serif type for text and the monospaced type for code. Both fonts are
loaded from [Google Fonts][] and can be easily changed to other fonts, like for
example Google's own [Roboto font][]:
Material uses the [Roboto font family][8] by default, specifically the regular
sans-serif type for text and the `monospaced` type for code. Both fonts are
loaded from [Google Fonts][9] and can easily be changed to other fonts, like
for example the [Ubuntu font family][10]:
``` yaml
extra:
font:
text: 'Roboto'
code: 'Roboto Mono'
text: 'Ubuntu'
code: 'Ubuntu Mono'
```
The text font will be loaded in font-weights 400 and **700**, the monospaced
The text font will be loaded in font-weights 400 and **700**, the `monospaced`
font in regular weight. If you want to load fonts from other destinations or
don't want to use the Google Fonts loading magic, just set `extra.font` to
`'none'`:
don't want to use the Google Fonts loading magic, just set `font` to `'none'`:
``` yaml
extra:
font: 'none'
```
### Localization
[8]: https://fonts.google.com/specimen/Roboto
[9]: https://fonts.google.com/
[10]: https://fonts.google.com/specimen/Ubuntu
The following texts and labels can easily be changed by defining variables:
### Adding a logo
Material makes it easy to add your logo. Your logo should have rectangular
shape with a minimum resolution of 128x128, leave some room towards the edges
and be composed of high contrast areas on a transparent ground, as it will be
placed on the colored header bar and drawer. Simply create the folder
`docs/images`, add your logo and embed it with:
``` yaml
extra:
i18n:
prev: 'Previous' # "Previous" label in the footer
next: 'Next' # "Next" label in the footer
search: 'Search' # "Search" placeholder in the search bar
logo: 'images/logo.svg'
```
### Adding a GitHub and Twitter account
### Adding social links
If you have a GitHub and/or Twitter account, you can add links to your
accounts to the drawer by setting the variables `extra.author.github` and
`extra.author.twitter` respectively:
If you want to link your social accounts, the Material theme provides an easy
way for doing this in the footer of the documentation using the automatically
included [FontAwesome][11] webfont. The syntax is simple the `type` must
denote the name of the social service, e.g. `github`, `twitter` or `linkedin`
and the `link` must contain the URL you want to link to:
``` yaml
extra:
author:
github: 'my-github-handle'
twitter: 'my-twitter-handle'
social:
- type: 'github'
link: 'https://github.com/squidfunk'
- type: 'twitter'
link: 'https://twitter.com/squidfunk'
- type: 'linkedin'
link: 'https://de.linkedin.com/in/martin-donath-20a95039'
```
The links are generated in order and the `type` of the links must match the
name of the FontAwesome glyph. The `fa` is automatically added, so `github`
will result in `fa fa-github`.
[11]: http://fontawesome.io/icons/
### Google Analytics integration
Material makes it easy to integrate site tracking with Google Analytics.
Besides basic tracking, clicks on all outgoing links can be tracked, clicks on
the download and star button, as well as how site search is used. Tracking can
be activated in your project's `mkdocs.yml`:
MkDocs makes it easy to integrate site tracking with Google Analytics.
Besides basic tracking, clicks on all outgoing links can be tracked as well as
how site search is used. Tracking can be activated in your project's
`mkdocs.yml`:
``` yaml
google_analytics:
@ -211,86 +278,73 @@ google_analytics:
- 'auto'
```
### Localization <small>L10N</small>
In order to localize the labels (e.g. *Previous* and *Next* in the footer),
you can override the file `partials/i18n.html` to provide your own translations
inside the macro `t`:
``` jinja
{% macro t(key) %}{{ {
"edit.link.title": "Edit this page",
"footer.previous": "Previous",
"footer.next": "Next",
"search.placeholder": "Search",
"source.link.title": "Go to repository",
"toc.title": "Table of contents"
}[key] }}{% endmacro %}
```
Just copy the file from the original theme and make your adjustments. See the
section on [overriding partials][12] in the customization guide.
!!! warning "Migrating from Material 0.2.x"
In 0.2.x localization was done within the `extra` configuration of your
`mkdocs.yml`. With 1.0.0 this is no longer possible as the configuration
will be ignored.
[12]: customization.md#overriding-partials
### More advanced customization
If you want to change the general appearance of the Material theme, see
[this article](customization.md) for more information on advanced customization.
[this article][13] for more information on advanced customization.
[13]: customization.md
## Extensions
MkDocs supports several [Markdown extensions][]. The following extensions are
not enabled by default (see the link for which are enabled by default), so you
have to switch them on explicitly.
### CodeHilite (recommended)
This extensions uses [Pygments][] (install with `pip install pygments`) to add
code highlighting to fenced code blocks. It might not be the best code
highlighter, but it works without JavaScript and on the server:
``` yaml
markdown_extensions:
- codehilite(css_class=code)
```
If you want more extensive highlighting, you can use a JavaScript library like
[highlight.js][], which is not included in Material. See [this link][extra] for
further instructions
### Permalinks
In order to add [permalinks][] to the headers of your article, set the
`markdown_extensions.toc.permalink` variable to a symbol, e.g. `#`:
``` yaml
markdown_extensions:
- toc:
permalink: '#'
```
The symbol can be chosen freely, it can even be a WebFont icon.
### Admonition
[Admonition][] is a handy extension that adds block-styled side content to your
documentation, for example hints, notes or warnings. It can be enabled by
setting the variable `markdown_extensions.admonition`:
MkDocs supports several [Markdown extensions][14]. The following extensions
are not enabled by default (see the link for which are enabled by default)
but highly recommended, so they should be switched on at all times:
``` yaml
markdown_extensions:
- admonition
- codehilite(guess_lang=false)
- toc(permalink=true)
```
In order to add a note, use the following syntax inside your article:
For more information, see the following list of extensions supported by the
Material theme including more information regarding installation and usage:
``` markdown
!!! note
Nothing to see here, move along.
```
* [Admonition][15]
* [Codehilite][16]
* [Permalinks][17]
* [Footnotes][18]
* [PyMdown Extensions][19]
This will print the following block:
!!! note
Nothing to see here, move along.
The Material template adds a neutral color for the `note` class and a red color
for the `warning` class. You can also add a custom title:
``` markdown
!!! warning "Don't try this at home"
If you do, you will regret it.
```
This will print:
!!! warning "Don't try this at home"
If you do, you will regret it.
More colors can be freely defined.
[14]: http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
[15]: extensions/admonition.md
[16]: extensions/codehilite.md
[17]: extensions/permalinks.md
[18]: extensions/footnotes.md
[19]: extensions/pymdown.md
## Full example
Below is a full example configuration for a mkdocs.yml:
Below is a full example configuration for a `mkdocs.yml`:
``` yaml
# Project information
@ -304,28 +358,27 @@ repo_name: 'GitHub'
repo_url: 'https://github.com/my-github-handle/my-project'
# Copyright
copyright: 'Copyright (c) 2016 John Doe'
copyright: 'Copyright &copy; 2016 John Doe'
# Documentation and theme
docs_dir: 'docs'
theme: 'material'
# Options
extra:
version: '0.1.0'
logo: 'images/logo.png'
logo: 'images/logo.svg'
palette:
primary: 'indigo'
accent: 'light blue'
accent: 'indigo'
font:
text: 'Roboto'
code: 'Roboto Mono'
i18n:
prev: 'Previous'
next: 'Next'
author:
github: 'my-github-handle'
twitter: 'my-twitter-handle'
social:
- type: 'github'
link: 'https://github.com/squidfunk'
- type: 'twitter'
link: 'https://twitter.com/squidfunk'
- type: 'linkedin'
link: 'https://de.linkedin.com/in/martin-donath-20a95039'
# Google Analytics
google_analytics:
@ -334,20 +387,9 @@ google_analytics:
# Extensions
markdown_extensions:
- codehilite(css_class=code)
- admonition
- toc:
permalink: '#'
- codehilite(guess_lang=false)
- footnotes
- meta
- toc(permalink=true)
```
[MkDocs]: http://www.mkdocs.org
[color palette]: http://www.materialui.co/colors
[Ubuntu font family]: http://font.ubuntu.com
[Google Fonts]: https://www.google.com/fonts
[Roboto font]: https://www.google.com/fonts/specimen/Roboto
[Markdown extensions]: http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
[Pygments]: http://pygments.org
[highlight.js]: https://highlightjs.org
[extra]: http://www.mkdocs.org/user-guide/styling-your-docs/#customising-a-theme
[permalinks]: https://en.wikipedia.org/wiki/Permalink
[Admonition]: https://pythonhosted.org/Markdown/extensions/admonition.html

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 KiB

View File

@ -1,22 +1,17 @@
# Material for MkDocs
# Material <small>for MkDocs</small>
## Beautiful documentation
## Beautiful project documentation
Material is a theme for [MkDocs][], an excellent static site generator geared
towards project documentation. It is built using Google's [material design][]
guidelines, full responsive, optimized for touch and pointer devices as well
as all sorts of screen sizes.
Material is a theme for [MkDocs][1], an excellent static site generator geared
towards project documentation. It is built using Google's [Material Design][2]
guidelines.
![Material Screenshot](images/screen.png)
Material is very lightweight it is built from scratch using Javascript and
CSS that weighs less than 30kb (minified, gzipped and excluding Google Fonts
and Analytics). Yet, it is highly customizable and degrades gracefully in older
browsers.
[1]: http://www.mkdocs.org
[2]: https://www.google.com/design/spec/material-design
## Quick start
Install with `pip`:
Install the latest version of Material with `pip`:
``` sh
pip install mkdocs-material
@ -28,39 +23,6 @@ Add the following line to your `mkdocs.yml`:
theme: 'material'
```
## Features
For detailed instructions see the [getting started guide][3].
- Beautiful, readable and very user-friendly design based on Google's material
design guidelines, packed in a full responsive template with a well-defined
and [easily customizable color palette][], great typography, as well as a
beautiful search interface and footer.
- Well-tested and optimized Javascript and CSS including a cross-browser
fixed/sticky header, a drawer that even works without Javascript using
the [checkbox hack][] with fallbacks, responsive tables that scroll when
the screen is too small and well-defined print styles.
- Extra configuration options like a [project logo][], links to the authors
[GitHub and Twitter accounts][], display of the amount of stars the
project has on GitHub and [Google Analytics integration][].
- Easily [extendable and customizable][] due to a well-designed asset pipeline
built on-top of [Gulp][] with `npm` and `bower` and modular and abstracted
style definitions built with [SASS][].
- Web application capability on iOS when the page is saved to the homescreen,
it behaves and looks like a native application.
See the [getting started guide](getting-started.md) for instructions how to get
it up and running.
[MkDocs]: http://www.mkdocs.org
[material design]: https://www.google.com/design/spec/material-design
[checkbox hack]: http://tutorialzine.com/2015/08/quick-tip-css-only-dropdowns-with-the-checkbox-hack/
[project logo]: getting-started.md#adding-a-logo
[easily customizable color palette]: getting-started.md#changing-the-color-palette
[GitHub and Twitter accounts]: getting-started.md#adding-a-github-and-twitter-account
[Google Analytics integration]: getting-started.md#google-analytics-integration
[extendable and customizable]: customization.md
[Gulp]: http://gulpjs.com
[SASS]: http://sass-lang.com
[3]: getting-started.md

View File

@ -2,7 +2,7 @@
**MIT License**
Copyright (c) 2016 Martin Donath
Copyright &copy; 2016 Martin Donath
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@ -20,4 +20,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
IN THE SOFTWARE.

140
docs/release-notes.md Normal file
View File

@ -0,0 +1,140 @@
# Release Notes
## Upgrading
To upgrade Material to the latest version, use pip:
``` sh
pip install --upgrade mkdocs-material
```
To determine the currently installed version, use the following command:
``` sh
pip show mkdocs-material | grep -E ^Version
# Version 1.0.0
```
## Changelog
### 1.0.0 <small> _ January 13, 2017</small>
* Introduced Webpack for more sophisticated JavaScript bundling
* Introduced ESLint and Stylelint for code style checks
* Introduced more accurate Material Design colors and shadows
* Introduced modular scales for harmonic font sizing
* Introduced git-hooks for better development workflow
* Rewrite of CSS using the BEM methodology and SassDoc guidelines
* Rewrite of JavaScript using ES6 and Babel as a transpiler
* Rewrite of Admonition, Permalinks and CodeHilite integration
* Rewrite of the complete typographical system
* Rewrite of Gulp asset pipeline in ES6 and separation of tasks
* Removed Bower as a dependency in favor of NPM
* Removed custom icon build in favor of the Material Design iconset
* Removed `_blank` targets on links due to vulnerability: http://bit.ly/1Mk2Rtw
* Removed unversioned assets from build directory
* Restructured templates into base templates and partials
* Added build and watch scripts in `package.json`
* Added support for Metadata and Footnotes Markdown extensions
* Added support for PyMdown Extensions package
* Added support for collapsible sections in navigation
* Added support for separate table of contents
* Added support for better accessibility through REM-based layout
* Added icons for GitHub, GitLab and BitBucket integrations
* Added more detailed documentation on specimen, extensions etc.
* Added a `404.html` error page for deployment on GitHub Pages
* Fixed live reload chain in watch mode when saving a template
* Fixed variable references to work with MkDocs 0.16
### 0.2.4 <small> _ June 26, 2016</small>
* Fixed improperly set default favicon
* Fixed [#33][33]: Protocol relative URL for webfonts doesn't work with
`file://`
* Fixed [#34][34]: IE11 on Windows 7 doesn't honor `max-width` on `main` tag
* Fixed [#35][35]: Add styling for blockquotes
[33]: https://github.com/squidfunk/mkdocs-material/issues/25
[34]: https://github.com/squidfunk/mkdocs-material/issues/26
[35]: https://github.com/squidfunk/mkdocs-material/issues/30
### 0.2.3 <small> _ May 16, 2016</small>
* Fixed [#25][25]: Highlight inline fenced blocks
* Fixed [#26][26]: Better highlighting for keystrokes
* Fixed [#30][30]: Suboptimal syntax highlighting for PHP
[25]: https://github.com/squidfunk/mkdocs-material/issues/25
[26]: https://github.com/squidfunk/mkdocs-material/issues/26
[30]: https://github.com/squidfunk/mkdocs-material/issues/30
### 0.2.2 <small> _ March 20, 2016</small>
* Fixed [#15][15]: Document Pygments dependency for CodeHilite
* Fixed [#16][16]: Favicon could not be set through `mkdocs.yml`
* Fixed [#17][17]: Put version into own container for styling
* Fixed [#20][20]: Fix rounded borders for tables
[15]: https://github.com/squidfunk/mkdocs-material/issues/15
[16]: https://github.com/squidfunk/mkdocs-material/issues/16
[17]: https://github.com/squidfunk/mkdocs-material/issues/17
[20]: https://github.com/squidfunk/mkdocs-material/issues/20
### 0.2.1 <small> _ March 12, 2016</small>
* Fixed [#10][10]: Invisible header after closing search bar with
<kbd>ESC</kbd> key
* Fixed [#13][13]: Table cells don't wrap
* Fixed empty list in table of contents when no headline is defined
* Corrected wrong path for static asset monitoring in Gulpfile.js
* Set up tracking of site search for Google Analytics
[10]: https://github.com/squidfunk/mkdocs-material/issues/10
[13]: https://github.com/squidfunk/mkdocs-material/issues/13
### 0.2.0 <small> _ February 24, 2016</small>
* Fixed [#6][6]: Include multiple color palettes via `mkdocs.yml`
* Fixed [#7][7]: Better colors for links inside admonition notes and warnings
* Fixed [#9][9]: Text for prev/next footer navigation should be customizable
* Refactored templates (replaced `if`/`else` with modifiers where possible)
[6]: https://github.com/squidfunk/mkdocs-material/issues/6
[7]: https://github.com/squidfunk/mkdocs-material/issues/7
[9]: https://github.com/squidfunk/mkdocs-material/issues/9
### 0.1.3 <small> _ February 21, 2016</small>
* Fixed [#3][3]: Ordered lists within an unordered list have `::before` content
* Fixed [#4][4]: Click on Logo/Title without Github-Repository: `"None"`
* Fixed [#5][5]: Page without headlines renders empty list in table of contents
* Moved Modernizr to top to ensure basic usability in IE8
[3]: https://github.com/squidfunk/mkdocs-material/issues/3
[4]: https://github.com/squidfunk/mkdocs-material/issues/4
[5]: https://github.com/squidfunk/mkdocs-material/issues/5
### 0.1.2 <small> _ February 16, 2016</small>
* Fixed styles for deep navigational hierarchies
* Fixed webfont delivery problem when hosted in subdirectories
* Fixed print styles in mobile/tablet configuration
* Added option to configure fonts in `mkdocs.yml` with fallbacks
* Changed styles for admonition notes and warnings
* Set download link to latest version if available
* Set up tracking of outgoing links and actions for Google Analytics
### 0.1.1 <small> _ February 11, 2016</small>
* Fixed [#1][1]: GitHub stars don't work if the repo_url ends with a `/`
* Updated NPM and Bower dependencies to most recent versions
* Changed footer/copyright link to Material theme to GitHub pages
* Made MkDocs building/serving in build process optional
* Set up continuous integration with [Travis][2]
[1]: https://github.com/squidfunk/mkdocs-material/issues/1
[2]: https://travis-ci.org
### 0.1.0 <small> _ February 9, 2016</small>
* Initial release

228
docs/specimen.md Normal file
View File

@ -0,0 +1,228 @@
# Specimen
## Body copy
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras arcu libero,
mollis sed massa vel, *ornare viverra ex*. Mauris a ullamcorper lacus. Nullam
urna elit, malesuada eget finibus ut, ullamcorper ac tortor. Vestibulum sodales
pulvinar nisl, pharetra aliquet est. Quisque volutpat erat ac nisi accumsan
tempor.
**Sed suscipit**, orci non pretium pretium, quam mi gravida metus, vel
venenatis justo est condimentum diam. Maecenas non ornare justo. Nam a ipsum
eros. [Nulla aliquam](/) orci sit amet nisl posuere malesuada. Proin aliquet
nulla velit, quis ultricies orci feugiat et. `Ut tincidunt sollicitudin`
tincidunt. Aenean ullamcorper sit amet nulla at interdum.
## Headings
### The 3rd level
#### The 4th level
##### The 5th level
###### The 6th level
## Headings <small>with secondary text</small>
### The 3rd level <small>with secondary text</small>
#### The 4th level <small>with secondary text</small>
##### The 5th level <small>with secondary text</small>
###### The 6th level <small>with secondary text</small>
## Blockquotes
> Morbi eget dapibus felis. Vivamus venenatis porttitor tortor sit amet rutrum.
Pellentesque aliquet quam enim, eu volutpat urna rutrum a. Nam vehicula nunc
mauris, a ultricies libero efficitur sed. *Class aptent* taciti sociosqu ad
litora torquent per conubia nostra, per inceptos himenaeos. Sed molestie
imperdiet consectetur.
### Blockquote nesting
> **Sed aliquet**, neque at rutrum mollis, neque nisi tincidunt nibh, vitae
faucibus lacus nunc at lacus. Nunc scelerisque, quam id cursus sodales, lorem
[libero fermentum](/) urna, ut efficitur elit ligula et nunc.
> > Mauris dictum mi lacus, sit amet pellentesque urna vehicula fringilla.
Ut sit amet placerat ante. Proin sed elementum nulla. Nunc vitae sem odio.
Suspendisse ac eros arcu. Vivamus orci erat, volutpat a tempor et, rutrum.
eu odio.
> > > `Suspendisse rutrum facilisis risus`, eu posuere neque commodo a.
Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed nec leo
bibendum, sodales mauris ut, tincidunt massa.
### Other content blocks
> Vestibulum vitae orci quis ante viverra ultricies ut eget turpis. Sed eu
lectus dapibus, eleifend nulla varius, lobortis turpis. In ac hendrerit nisl,
sit amet laoreet nibh.
``` js hl_lines="8"
var _extends = function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target;
};
```
> > Praesent at `:::js return target`, sodales nibh vel, tempor felis. Fusce
vel lacinia lacus. Suspendisse rhoncus nunc non nisi iaculis ultrices.
Donec consectetur mauris non neque imperdiet, eget volutpat libero.
## Lists
### Unordered lists
* Sed sagittis eleifend rutrum. Donec vitae suscipit est. Nullam tempus tellus
non sem sollicitudin, quis rutrum leo facilisis. Nulla tempor lobortis orci,
at elementum urna sodales vitae. In in vehicula nulla, quis ornare libero.
* Duis mollis est eget nibh volutpat, fermentum aliquet dui mollis.
* Nam vulputate tincidunt fringilla.
* Nullam dignissim ultrices urna non auctor.
* Aliquam metus eros, pretium sed nulla venenatis, faucibus auctor ex. Proin ut
eros sed sapien ullamcorper consequat. Nunc ligula ante, fringilla at aliquam
ac, aliquet sed mauris.
* Nulla et rhoncus turpis. Mauris ultricies elementum leo. Duis efficitur
accumsan nibh eu mattis. Vivamus tempus velit eros, porttitor placerat nibh
lacinia sed. Aenean in finibus diam.
### Ordered lists
1. Integer vehicula feugiat magna, a mollis tellus. Nam mollis ex ante, quis
elementum eros tempor rutrum. Aenean efficitur lobortis lacinia. Nulla
consectetur feugiat sodales.
2. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur
ridiculus mus. Aliquam ornare feugiat quam et egestas. Nunc id erat et quam
pellentesque lacinia eu vel odio.
1. Vivamus venenatis porttitor tortor sit amet rutrum. Pellentesque aliquet
quam enim, eu volutpat urna rutrum a. Nam vehicula nunc mauris, a
ultricies libero efficitur sed.
1. Mauris dictum mi lacus
2. Ut sit amet placerat ante
3. Suspendisse ac eros arcu
2. Morbi eget dapibus felis. Vivamus venenatis porttitor tortor sit amet
rutrum. Pellentesque aliquet quam enim, eu volutpat urna rutrum a. Sed
aliquet, neque at rutrum mollis, neque nisi tincidunt nibh.
3. Pellentesque eget `:::js var _extends` ornare tellus, ut gravida mi.
``` js hl_lines="1"
var _extends = function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target;
};
```
3. Vivamus id mi enim. Integer id turpis sapien. Ut condimentum lobortis
sagittis. Aliquam purus tellus, faucibus eget urna at, iaculis venenatis
nulla. Vivamus a pharetra leo.
## Code blocks
### Inline
Morbi eget `dapibus felis`. Vivamus *`venenatis porttitor`* tortor sit amet
rutrum. Class aptent taciti sociosqu ad litora torquent per conubia nostra,
per inceptos himenaeos. [`Pellentesque aliquet quam enim`](/), eu volutpat urna
rutrum a.
Nam vehicula nunc `:::js return target` mauris, a ultricies libero efficitur
sed. Sed molestie imperdiet consectetur. Vivamus a pharetra leo. Pellentesque
eget ornare tellus, ut gravida mi. Fusce vel lacinia lacus.
### Listing
#!js hl_lines="8"
var _extends = function(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target;
};
## Horizontal rules
Aenean in finibus diam. Duis mollis est eget nibh volutpat, fermentum aliquet
dui mollis. Nam vulputate tincidunt fringilla. Nullam dignissim ultrices urna
non auctor.
***
Integer vehicula feugiat magna, a mollis tellus. Nam mollis ex ante, quis
elementum eros tempor rutrum. Aenean efficitur lobortis lacinia. Nulla
consectetur feugiat sodales.
## Data tables
| Sollicitudo / Pellentesi | consectetur | adipiscing | elit | arcu | sed |
| ------------------------ | ----------- | ---------- | ------- | ---- | --- |
| Vivamus a pharetra | yes | yes | yes | yes | yes |
| Ornare viverra ex | yes | yes | yes | yes | yes |
| Mauris a ullamcorper | yes | yes | partial | yes | yes |
| Nullam urna elit | yes | yes | yes | yes | yes |
| Malesuada eget finibus | yes | yes | yes | yes | yes |
| Ullamcorper | yes | yes | yes | yes | yes |
| Vestibulum sodales | yes | - | yes | - | yes |
| Pulvinar nisl | yes | yes | yes | - | - |
| Pharetra aliquet est | yes | yes | yes | yes | yes |
| Sed suscipit | yes | yes | yes | yes | yes |
| Orci non pretium | yes | partial | - | - | - |
Sed sagittis eleifend rutrum. Donec vitae suscipit est. Nullam tempus tellus
non sem sollicitudin, quis rutrum leo facilisis. Nulla tempor lobortis orci,
at elementum urna sodales vitae. In in vehicula nulla, quis ornare libero.
| Left | Center | Right |
| :--------- | :------: | ------: |
| Lorem | *dolor* | `amet` |
| [ipsum](/) | **sit** | |
Vestibulum vitae orci quis ante viverra ultricies ut eget turpis. Sed eu
lectus dapibus, eleifend nulla varius, lobortis turpis. In ac hendrerit nisl,
sit amet laoreet nibh.
<table>
<colgroup>
<col width="30%">
<col width="70%">
</colgroup>
<thead>
<tr class="header">
<th>Table</th>
<th>with colgroups (Pandoc)</th>
</tr>
</thead>
<tbody>
<tr>
<td>Lorem</td>
<td>ipsum dolor sit amet.</td>
</tr>
<tr>
<td>Sed sagittis</td>
<td>eleifend rutrum. Donec vitae suscipit est.</td>
</tr>
</tbody>
</table>

70
lib/providers/jsx.js Normal file
View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/* ----------------------------------------------------------------------------
* Definition
* ------------------------------------------------------------------------- */
export default /* JSX */ {
/**
* Create a native DOM node from JSX's intermediate representation
*
* @param {string} tag - Tag name
* @param {object} properties - Properties
* @param {...(string|number|Array)} children - Child nodes
* @return {HTMLElement} Native DOM node
*/
createElement(tag, properties, ...children) {
const el = document.createElement(tag)
/* Set all properties */
if (properties)
Array.prototype.forEach.call(Object.keys(properties), attr => {
el.setAttribute(attr, properties[attr])
})
/* Iterate child nodes */
const iterateChildNodes = nodes => {
Array.prototype.forEach.call(nodes, node => {
/* Directly append text content */
if (typeof node === "string" ||
typeof node === "number") {
el.textContent += node
/* Recurse, if we got an array */
} else if (Array.isArray(node)) {
iterateChildNodes(node)
/* Append regular nodes */
} else {
el.appendChild(node)
}
})
}
/* Iterate child nodes and return element */
iterateChildNodes(children)
return el
}
}

5
lib/tasks/.eslintrc Normal file
View File

@ -0,0 +1,5 @@
{
"rules": {
"no-invalid-this": 0
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,39 +20,16 @@
* IN THE SOFTWARE.
*/
import changed from "gulp-changed"
/* ----------------------------------------------------------------------------
* Article typography
* Task: clean images generated by build
* ------------------------------------------------------------------------- */
/*
* Article
*/
.article {
/*
* Third-level headlines should be bold
*/
h3 {
font-weight: 700;
}
/*
* Fourth-level headlines should be italic
*/
h4 {
font-weight: 400;
font-style: italic;
export default (gulp, config) => {
return () => {
return gulp.src(`${config.assets.src}/images/**/*.ico`)
.pipe(changed(`${config.assets.build}/images`))
.pipe(gulp.dest(`${config.assets.build}/images`))
}
}
/*
* Permalink support
*/
.article {
h2, h3, h4, h5, h6 {
a {
font-weight: 400;
font-style: normal;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,69 +20,35 @@
* IN THE SOFTWARE.
*/
import changed from "gulp-changed"
import gulpif from "gulp-if"
import minsvg from "gulp-svgmin"
import rev from "gulp-rev"
import version from "gulp-rev-replace"
/* ----------------------------------------------------------------------------
* Code highlighter
* Task: clean images generated by build
* ------------------------------------------------------------------------- */
/*
* Code block
*/
pre {
background: rgba($black, 0.05);
/*
* Ensure correct color
*/
&, code {
color: $black;
export default (gulp, config, args) => {
return () => {
return gulp.src(`${config.assets.src}/images/**/*.svg`)
.pipe(changed(`${config.assets.build}/images`))
.pipe(gulpif(args.optimize,
minsvg({
plugins: [
{ cleanupIDs: false }
]
})))
.pipe(gulpif(args.revision, rev()))
.pipe(gulpif(args.revision,
version({ manifest: gulp.src("manifest.json") })))
.pipe(gulp.dest(`${config.assets.build}/images`))
.pipe(gulpif(args.revision,
rev.manifest("manifest.json", {
base: config.assets.build,
merge: true
})))
.pipe(gulpif(args.revision, gulp.dest(config.assets.build)))
}
}
/*
* Operators and comments
*/
.o, .c, .c1, .cm {
color: $black-light;
}
/*
* Keywords
*/
.k, .kn {
color: #A71D5D;
}
/*
* Types and functions
*/
.kt, .kd {
color: #0086B3;
}
/*
* Function definition
*/
.nf, .n.f {
color: #795da3;
}
/*
* Classes
*/
.nx {
color: #0086b3;
}
/*
* Strings
*/
.s, .s1 {
color: #183691;
}
/*
* Constants and numbers
*/
.mi, .bp {
color: #9575CD;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,28 +20,16 @@
* IN THE SOFTWARE.
*/
import clean from "del"
import vinyl from "vinyl-paths"
/* ----------------------------------------------------------------------------
* Palette
* Task: clean images generated by build
* ------------------------------------------------------------------------- */
/*
* Primary and accent color
*/
$primary: $red-400 !default;
$accent: $teal-a700 !default;
/*
* Black opacities
*/
$black: rgba(black, 0.87);
$black-light: rgba(black, 0.54);
$black-lighter: rgba(black, 0.26);
$black-lightest: rgba(black, 0.12);
/*
* White opacities
*/
$white: rgba(white, 1.00);
$white-light: rgba(white, 0.70);
$white-lighter: rgba(white, 0.30);
$white-lightest: rgba(white, 0.12);
export default (gulp, config) => {
return () => {
return gulp.src(`${config.assets.build}/images/*`)
.pipe(vinyl(clean))
}
}

View File

@ -0,0 +1,119 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import gulpif from "gulp-if"
import path from "path"
import rev from "gulp-rev"
import stream from "webpack-stream"
import version from "gulp-rev-replace"
import webpack from "webpack"
/* ----------------------------------------------------------------------------
* Task: build application logic
* ------------------------------------------------------------------------- */
export default (gulp, config, args) => {
return () => {
return gulp.src(`${config.assets.src}/javascripts/**/*.{js,jsx}`)
/* Build with webpack */
.pipe(
stream({
entry: [
/* Polyfills */
"core-js/fn/promise",
"custom-event-polyfill",
"whatwg-fetch",
/* Main entry point */
"application.js"
],
output: {
filename: "application.js",
library: "Application"
},
module: {
/* Transpile ES6 to ES5 with Babel */
loaders: [
{
loader: "babel-loader",
test: /\.jsx?$/
}
]
},
plugins: [
/* Don't emit assets that include errors */
new webpack.NoErrorsPlugin(),
/* Provide JSX helper */
new webpack.ProvidePlugin({
JSX: path.join(process.cwd(), `${config.lib}/providers/jsx.js`)
})
].concat(
/* Minify sources */
args.optimize ? [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
] : []),
/* Module resolver */
resolve: {
modulesDirectories: [
"src/assets/javascripts",
"node_modules"
],
extensions: [
"",
".js",
".jsx"
]
},
/* Webpack commandline output */
stats: {
colors: true
},
/* Sourcemap support */
devtool: args.sourcemaps ? "source-map" : ""
}))
/* Revisioning */
.pipe(gulpif(args.revision, rev()))
.pipe(gulpif(args.revision,
version({ manifest: gulp.src("manifest.json") })))
.pipe(gulp.dest(`${config.assets.build}/javascripts`))
.pipe(gulpif(args.revision,
rev.manifest("manifest.json", {
base: config.assets.build,
merge: true
})))
.pipe(gulpif(args.revision, gulp.dest(config.assets.build)))
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,62 +20,44 @@
* IN THE SOFTWARE.
*/
import concat from "gulp-concat"
import gulpif from "gulp-if"
import modernizr from "gulp-modernizr"
import uglify from "gulp-uglify"
import rev from "gulp-rev"
import version from "gulp-rev-replace"
/* ----------------------------------------------------------------------------
* Drawer animation
* Task: build custom modernizr
* ------------------------------------------------------------------------- */
/*
* Drawer container
*/
.drawer {
export default (gulp, config, args) => {
return () => {
return gulp.src(`${config.assets.build}/stylesheets/*.css`)
/* [tablet landscape-]: Hide menu */
@include break-to-device(tablet landscape) {
transform: translate3d(-262px, 0, 0);
transition: transform .25s cubic-bezier(.4, 0, .2, 1);
/* Build custom modernizr */
.pipe(
modernizr({
options: [
"addTest", /* Add custom tests */
"setClasses" /* Add CSS classes to root tag */
]
}))
.pipe(concat("modernizr.js"))
/*
* Just hide drawer, if browser doesn't support 3D transforms
*/
.no-csstransforms3d & {
display: none;
}
}
/* Minify sources */
.pipe(gulpif(args.optimize, uglify()))
/*
* Expanded drawer
*/
#toggle-drawer:checked ~ .main &,
.toggle-drawer & {
transform: translate3d(0, 0, 0);
/*
* Just show drawer, if browser doesn't support 3D transforms
*/
.no-csstransforms3d & {
display: block;
}
/* Revisioning */
.pipe(gulpif(args.revision, rev()))
.pipe(gulpif(args.revision,
version({ manifest: gulp.src("manifest.json") })))
.pipe(gulp.dest(`${config.assets.build}/javascripts`))
.pipe(gulpif(args.revision,
rev.manifest("manifest.json", {
base: config.assets.build,
merge: true
})))
.pipe(gulpif(args.revision, gulp.dest(config.assets.build)))
}
}
/*
* No color transition for project link
*/
.project {
transition: none;
}
/*
* Project logo image
*/
.project .logo img {
transition: box-shadow .4s;
}
/*
* Repository buttons
*/
.repo a {
transition: box-shadow .4s,
opacity .4s;
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import clean from "del"
import vinyl from "vinyl-paths"
/* ----------------------------------------------------------------------------
* Task: clean JavaScript generated by build
* ------------------------------------------------------------------------- */
export default (gulp, config) => {
return () => {
return gulp.src(`${config.assets.build}/javascripts/*`)
.pipe(vinyl(clean))
}
}

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import path from "path"
import through from "through2"
import util from "gulp-util"
import { CLIEngine } from "eslint"
/* ----------------------------------------------------------------------------
* Locals
* ------------------------------------------------------------------------- */
const eslint = new CLIEngine
const format = eslint.getFormatter()
/* ----------------------------------------------------------------------------
* Task: lint JavaScript
* ------------------------------------------------------------------------- */
export default (gulp, config) => {
return () => {
return gulp.src(`${config.assets.src}/javascripts/**/*.js`)
/* Linting */
.pipe(
through.obj(function(file, enc, done) {
if (file.isNull() || file.isStream())
return done()
/* Lint file using .eslintrc */
file.eslint = eslint.executeOnText(
file.contents.toString())
/* Correct file path */
file.eslint.results[0].filePath =
path.relative(process.cwd(), file.path)
/* Push file to next stage */
this.push(file)
done()
}))
/* Print errors */
.pipe(
through.obj(function(file, enc, done) {
if (file.eslint.errorCount || file.eslint.warningCount) {
// eslint-disable-next-line no-console
console.log(format(file.eslint.results))
}
/* Push file to next stage */
this.push(file)
done()
}))
/* Terminate on error */
.pipe(
(() => {
const errors = []
/* Gather errors */
return through.obj(function(file, enc, done) {
const results = file.eslint
/* Consider warnings as errors */
if (results.errorCount || results.warningCount)
errors.push(file)
/* Push file to next stage */
this.push(file)
done()
/* Format errors and terminate */
}, function(done) {
if (errors.length > 0) {
const message = errors.map(file => {
return file.relative
}).join(", ")
/* Emit error */
this.emit("error", new util.PluginError("eslint",
`Terminated with errors in files: ${message}`))
}
done()
})
})())
}
}

View File

@ -0,0 +1,75 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import autoprefixer from "autoprefixer"
import gulpif from "gulp-if"
import mincss from "gulp-cssnano"
import mqpacker from "css-mqpacker"
import postcss from "gulp-postcss"
import rev from "gulp-rev"
import sass from "gulp-sass"
import sourcemaps from "gulp-sourcemaps"
import version from "gulp-rev-replace"
/* ----------------------------------------------------------------------------
* Task: build stylesheets from SASS source
* ------------------------------------------------------------------------- */
export default (gulp, config, args) => {
return () => {
return gulp.src(`${config.assets.src}/stylesheets/*.scss`)
.pipe(gulpif(args.sourcemaps, sourcemaps.init()))
/* Compile SASS sources */
.pipe(
sass({
includePaths: [
"node_modules/modularscale-sass/stylesheets",
"node_modules/material-design-color",
"node_modules/material-shadows"
]
}))
/* Apply PostCSS plugins */
.pipe(
postcss([
autoprefixer(),
mqpacker
]))
/* Minify sources */
.pipe(gulpif(args.optimize, mincss()))
/* Revisioning */
.pipe(gulpif(args.revision, rev()))
.pipe(gulpif(args.revision,
version({ manifest: gulp.src("manifest.json") })))
.pipe(gulpif(args.sourcemaps, sourcemaps.write(".")))
.pipe(gulp.dest(`${config.assets.build}/stylesheets`))
.pipe(gulpif(args.revision,
rev.manifest("manifest.json", {
base: config.assets.build,
merge: true
})))
.pipe(gulpif(args.revision, gulp.dest(config.assets.build)))
}
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import clean from "del"
import vinyl from "vinyl-paths"
/* ----------------------------------------------------------------------------
* Task: clean stylesheets generated by build
* ------------------------------------------------------------------------- */
export default (gulp, config) => {
return () => {
return gulp.src(`${config.assets.build}/stylesheets/*`)
.pipe(vinyl(clean))
}
}

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import stylelint from "gulp-stylelint"
/* ----------------------------------------------------------------------------
* Task: lint SASS sources
* ------------------------------------------------------------------------- */
export default (gulp, config) => {
return () => {
return gulp.src(`${config.assets.src}/stylesheets/**/*.scss`)
.pipe(
stylelint({
reporters: [
{ formatter: "string", console: true }
]
}))
}
}

36
lib/tasks/mkdocs/build.js Normal file
View File

@ -0,0 +1,36 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import child from "child_process"
/* ----------------------------------------------------------------------------
* Task: build documentation
* ------------------------------------------------------------------------- */
export default () => {
return () => {
const proc = child.spawnSync("mkdocs", ["build"])
if (proc.status)
throw new Error(`MkDocs error:\n${proc.stderr.toString()}`)
return proc
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,26 +20,16 @@
* IN THE SOFTWARE.
*/
import clean from "del"
import vinyl from "vinyl-paths"
/* ----------------------------------------------------------------------------
* Article animation
* Task: clean documentation build
* ------------------------------------------------------------------------- */
/*
* Fade color after highlighting
*/
pre span {
transition: color .25s;
}
/*
* Copyright and theme information
*/
.copyright {
/*
* Animate color on hover
*/
a {
transition: color .25s;
export default gulp => {
return () => {
return gulp.src("site")
.pipe(vinyl(clean))
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,49 +20,27 @@
* IN THE SOFTWARE.
*/
import child from "child_process"
/* ----------------------------------------------------------------------------
* Drawer typography
* Locals
* ------------------------------------------------------------------------- */
/*
* Drawer container
*/
.drawer {
/* MkDocs server */
let server = null
/*
* Links to articles
*/
.toc li a {
font-weight: 700;
}
/* ----------------------------------------------------------------------------
* Task: serve documentation
* ------------------------------------------------------------------------- */
/*
* Links to chapters inside the current article
*/
.toc li.anchor a {
font-weight: 400;
}
export default () => {
return () => {
if (server)
server.kill()
/*
* Main sections
*/
.section {
font-weight: 700;
/* Spawn MkDocs server */
server = child.spawn("mkdocs", ["serve", "-a", "0.0.0.0:8000"], {
stdio: "inherit"
})
}
}
/*
* Repository buttons
*/
.repo a {
text-transform: uppercase;
font-weight: 700;
/*
* Stars
*/
.count {
text-transform: none;
font-weight: 700;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -20,58 +20,53 @@
* IN THE SOFTWARE.
*/
import selenium from "selenium-standalone"
/* ----------------------------------------------------------------------------
* Print overrides
* Locals
* ------------------------------------------------------------------------- */
/*
* Print styles
*/
@media print {
/* Selenium server */
let server = null
/*
* Hide non-relevant elements
*/
.header, .drawer, .headerlink, .footer {
display: none;
}
/* ----------------------------------------------------------------------------
* Definition
* ------------------------------------------------------------------------- */
/*
* Article
*/
.article {
export const start = done => {
selenium.start({}, (err, proc) => {
if (err) {
/*
* Remove top spacing
*/
.wrapper {
padding-top: 0;
}
/* Install selenium, if not present */
if (/^Missing(.*)chromedriver$/.test(err.message)) {
selenium.install(done)
/*
* Remove color in all code blocks
*/
pre, pre * {
color: $black !important;
}
/* Start selenium again */
selenium.start({}, (err_, proc_) => {
server = proc_
})
pre {
border: 1px solid $black-lightest;
}
/*
* Border-radius makes this table entirely black on paper, so scrap it
*/
table {
border-radius: none;
box-shadow: none;
/*
* Color header
*/
th {
color: $primary;
/* Otherwise, throw error */
} else {
throw err
}
}
}
}
/* Remember process handle */
server = server || proc
done()
})
}
export const stop = () => {
if (server)
server.kill()
}
/* ----------------------------------------------------------------------------
* Signal handler
* ------------------------------------------------------------------------- */
/* Register signal handler for all relevant events */
for (const signal of ["SIGTERM", "SIGINT", "exit"])
process.on(signal, stop)

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import path from "path"
import { Server, stopper } from "karma"
/* ----------------------------------------------------------------------------
* Task: start karma test runner
* ------------------------------------------------------------------------- */
export default () => {
return done => {
new Server({
configFile: path.join(process.cwd(), "tests/karma.conf.js")
}, done).start()
/* Register signal handler for all relevant events */
for (const signal of ["SIGTERM", "SIGINT", "exit"])
process.on(signal, () => {
return stopper.stop({
port: 9876,
logLevel: "OFF"
})
})
}
}

58
lib/tasks/views/build.js Normal file
View File

@ -0,0 +1,58 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import changed from "gulp-changed"
import compact from "gulp-remove-empty-lines"
import gulpif from "gulp-if"
import minhtml from "gulp-htmlmin"
import path from "path"
import replace from "gulp-replace"
import version from "gulp-rev-replace"
/* ----------------------------------------------------------------------------
* Task: minify views
* ------------------------------------------------------------------------- */
export default (gulp, config, args) => {
return () => {
const metadata = require(path.join(process.cwd(), "./package.json"))
return gulp.src(`${config.views.src}/**/*.{html,py}`)
.pipe(changed(config.views.build))
.pipe(
minhtml({
collapseBooleanAttributes: true,
customAttrCollapse: /(content)/,
includeAutoGeneratedTags: false,
minifyCSS: true,
minifyJS: true,
removeComments: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
}))
.pipe(replace("$theme-name$", metadata.name))
.pipe(replace("$theme-version$", metadata.version))
.pipe(compact())
.pipe(gulpif(args.revision,
version({ manifest: gulp.src("manifest.json") })))
.pipe(gulp.dest(config.views.build))
}
}

35
lib/tasks/views/clean.js Normal file
View File

@ -0,0 +1,35 @@
/*
* Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
import clean from "del"
import vinyl from "vinyl-paths"
/* ----------------------------------------------------------------------------
* Task: clean views
* ------------------------------------------------------------------------- */
export default (gulp, config) => {
return () => {
return gulp.src(`${config.views.build}/**/*.html`)
.pipe(vinyl(clean))
}
}

4
material/404.html Normal file
View File

@ -0,0 +1,4 @@
{% extends "main.html" %}
{% block content %}
<h1>404 - Not found</h1>
{% endblock %}

Binary file not shown.

View File

@ -1,22 +0,0 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="icon" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe600;" glyph-name="search" d="M661.333 341.334h-33.92l-11.733 11.733c41.813 48.427 66.987 111.36 66.987 180.267 0 153.173-124.16 277.333-277.333 277.333s-277.333-124.16-277.333-277.333 124.16-277.333 277.333-277.333c68.907 0 131.84 25.173 180.267 66.773l11.733-11.733v-33.707l213.333-212.907 63.573 63.573-212.907 213.333zM405.333 341.334c-106.027 0-192 85.973-192 192s85.973 192 192 192 192-85.973 192-192-85.973-192-192-192z" />
<glyph unicode="&#xe601;" glyph-name="arrow-back" d="M853.333 469.334h-519.253l238.293 238.293-60.373 60.373-341.333-341.333 341.333-341.333 60.373 60.373-238.293 238.293h519.253v85.333z" />
<glyph unicode="&#xe602;" glyph-name="chevron-right" d="M426.667 682.667l-60.373-60.373 195.627-195.627-195.627-195.627 60.373-60.373 256 256z" />
<glyph unicode="&#xe603;" glyph-name="close" d="M810.667 664.96l-60.373 60.373-238.293-238.293-238.293 238.293-60.373-60.373 238.293-238.293-238.293-238.293 60.373-60.373 238.293 238.293 238.293-238.293 60.373 60.373-238.293 238.293z" />
<glyph unicode="&#xe604;" glyph-name="menu" d="M128 170.667h768v85.333h-768v-85.333zM128 384h768v85.333h-768v-85.333zM128 682.667v-85.333h768v85.333h-768z" />
<glyph unicode="&#xe605;" glyph-name="arrow-forward" d="M512 768l-60.373-60.373 238.293-238.293h-519.253v-85.333h519.253l-238.293-238.293 60.373-60.373 341.333 341.333z" />
<glyph unicode="&#xe606;" glyph-name="twitter" d="M1024 744.249c-37.676-16.708-78.164-28.002-120.66-33.080 43.372 26 76.686 67.17 92.372 116.23-40.596-24.078-85.556-41.56-133.41-50.98-38.32 40.83-92.922 66.34-153.346 66.34-116.022 0-210.088-94.058-210.088-210.078 0-16.466 1.858-32.5 5.44-47.878-174.6 8.764-329.402 92.4-433.018 219.506-18.084-31.028-28.446-67.116-28.446-105.618 0-72.888 37.088-137.192 93.46-174.866-34.438 1.092-66.832 10.542-95.154 26.278-0.020-0.876-0.020-1.756-0.020-2.642 0-101.788 72.418-186.696 168.522-206-17.626-4.8-36.188-7.372-55.348-7.372-13.538 0-26.698 1.32-39.528 3.772 26.736-83.46 104.32-144.206 196.252-145.896-71.9-56.35-162.486-89.934-260.916-89.934-16.958 0-33.68 0.994-50.116 2.94 92.972-59.61 203.402-94.394 322.042-94.394 386.422 0 597.736 320.124 597.736 597.744 0 9.108-0.206 18.168-0.61 27.18 41.056 29.62 76.672 66.62 104.836 108.748z" />
<glyph unicode="&#xe607;" glyph-name="github" d="M512.008 926.025c-282.738 0-512.008-229.218-512.008-511.998 0-226.214 146.704-418.132 350.136-485.836 25.586-4.738 34.992 11.11 34.992 24.632 0 12.204-0.48 52.542-0.696 95.324-142.448-30.976-172.504 60.41-172.504 60.41-23.282 59.176-56.848 74.916-56.848 74.916-46.452 31.778 3.51 31.124 3.51 31.124 51.4-3.61 78.476-52.766 78.476-52.766 45.672-78.27 119.776-55.64 149.004-42.558 4.588 33.086 17.852 55.68 32.506 68.464-113.73 12.942-233.276 56.85-233.276 253.032 0 55.898 20.004 101.574 52.76 137.428-5.316 12.9-22.854 64.972 4.952 135.5 0 0 43.006 13.752 140.84-52.49 40.836 11.348 84.636 17.036 128.154 17.234 43.502-0.198 87.336-5.886 128.256-17.234 97.734 66.244 140.656 52.49 140.656 52.49 27.872-70.528 10.35-122.6 5.036-135.5 32.82-35.856 52.694-81.532 52.694-137.428 0-196.654-119.778-239.95-233.79-252.624 18.364-15.89 34.724-47.046 34.724-94.812 0-68.508-0.596-123.644-0.596-140.508 0-13.628 9.222-29.594 35.172-24.566 203.322 67.776 349.842 259.626 349.842 485.768 0 282.78-229.234 511.998-511.992 511.998z" />
<glyph unicode="&#xe608;" glyph-name="download" d="M810.667 554.667h-170.667v256h-256v-256h-170.667l298.667-298.667 298.667 298.667zM213.333 170.667v-85.333h597.333v85.333h-597.333z" />
<glyph unicode="&#xe609;" glyph-name="star" d="M512 201.814l263.68-159.147-69.973 299.947 232.96 201.813-306.773 26.027-119.893 282.88-119.893-282.88-306.773-26.027 232.96-201.813-69.973-299.947z" />
<glyph unicode="&#xe610;" glyph-name="warning" d="M554 340.667v172h-84v-172h84zM554 170.667v86h-84v-86h84zM42 42.667l470 810 470-810h-940z" />
<glyph unicode="&#xe611;" glyph-name="hint" d="M614 682.667h240v-426h-300l-16 84h-240v-298h-84v726h384z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="352" height="448" viewBox="0 0 352 448" id="bitbucket"><path fill="currentColor" d="M203.75 214.75q2 15.75-12.625 25.25t-27.875 1.5q-9.75-4.25-13.375-14.5t-.125-20.5 13-14.5q9-4.5 18.125-3t16 8.875 6.875 16.875zm27.75-5.25q-3.5-26.75-28.25-41T154 165.25q-15.75 7-25.125 22.125t-8.625 32.375q1 22.75 19.375 38.75t41.375 14q22.75-2 38-21t12.5-42zM291.25 74q-5-6.75-14-11.125t-14.5-5.5T245 54.25q-72.75-11.75-141.5.5-10.75 1.75-16.5 3t-13.75 5.5T60.75 74q7.5 7 19 11.375t18.375 5.5T120 93.75Q177 101 232 94q15.75-2 22.375-3t18.125-5.375T291.25 74zm14.25 258.75q-2 6.5-3.875 19.125t-3.5 21-7.125 17.5-14.5 14.125q-21.5 12-47.375 17.875t-50.5 5.5-50.375-4.625q-11.5-2-20.375-4.5T88.75 412 70.5 401.125t-13-15.375q-6.25-24-14.25-73l1.5-4 4.5-2.25q55.75 37 126.625 37t126.875-37q5.25 1.5 6 5.75t-1.25 11.25-2 9.25zM350.75 92.5q-6.5 41.75-27.75 163.75-1.25 7.5-6.75 14t-10.875 10T291.75 288q-63 31.5-152.5 22-62-6.75-98.5-34.75-3.75-3-6.375-6.625t-4.25-8.75-2.25-8.5-1.5-9.875T25 232.75q-2.25-12.5-6.625-37.5t-7-40.375T5.5 118 0 78.5Q.75 72 4.375 66.375T12.25 57t11.25-7.5T35 43.875t12-4.625q31.25-11.5 78.25-16 94.75-9.25 169 12.5Q333 47.25 348 66.25q4 5 4.125 12.75t-1.375 13.5z"/></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448" viewBox="0 0 416 448" id="github"><path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19T128 352t-18.125-8.5-10.75-19T96 304t3.125-20.5 10.75-19T128 256t18.125 8.5 10.75 19T160 304zm160 0q0 10-3.125 20.5t-10.75 19T288 352t-18.125-8.5-10.75-19T256 304t3.125-20.5 10.75-19T288 256t18.125 8.5 10.75 19T320 304zm40 0q0-30-17.25-51T296 232q-10.25 0-48.75 5.25Q229.5 240 208 240t-39.25-2.75Q130.75 232 120 232q-29.5 0-46.75 21T56 304q0 22 8 38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0 37.25-1.75t35-7.375 30.5-15 20.25-25.75T360 304zm56-44q0 51.75-15.25 82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5T212 416q-19.5 0-35.5-.75t-36.875-3.125-38.125-7.5-34.25-12.875T37 371.5t-21.5-28.75Q0 312 0 260q0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25 30.875Q171.5 96 212 96q37 0 70 8 26.25-20.5 46.75-30.25T376 64q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34 99.5z"/></svg>

After

Width:  |  Height:  |  Size: 991 B

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" viewBox="0 0 500 500" id="gitlab"><path fill="currentColor" d="M93.667 473.347l90.684-279.097H2.983l90.684 279.097z" transform="translate(156.198 1.16)"/><path fill="currentColor" d="M221.333 473.345L130.649 194.25H3.557l217.776 279.095z" transform="translate(28.531 1.16)" opacity=".7"/><path fill="currentColor" d="M32 195.155L4.441 279.97a18.773 18.773 0 0 0 6.821 20.99l238.514 173.29L32 195.155z" transform="translate(.089 .256)" opacity=".5"/><path fill="currentColor" d="M2.667-84.844h127.092L75.14-252.942c-2.811-8.649-15.047-8.649-17.856 0L2.667-84.844z" transform="translate(29.422 280.256)"/><path fill="currentColor" d="M2.667 473.345L93.351 194.25h127.092L2.667 473.345z" transform="translate(247.198 1.16)" opacity=".7"/><path fill="currentColor" d="M221.334 195.155l27.559 84.815a18.772 18.772 0 0 1-6.821 20.99L3.557 474.25l217.777-279.095z" transform="translate(246.307 .256)" opacity=".5"/><path fill="currentColor" d="M130.667-84.844H3.575l54.618-168.098c2.811-8.649 15.047-8.649 17.856 0l54.618 168.098z" transform="translate(336.974 280.256)"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,180 +1,120 @@
{% import "partials/i18n.html" as i18n %}
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js"> <!--<![endif]-->
<html class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1">
{% block htmltitle %}
{% if page_title %}
<title>{{ page_title }} - {{ site_name }}</title>
{% elif page_description %}
<title>{{ site_name }} - {{ page_description }}</title>
{% block site_meta %}
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
{% if config.site_description %}
<meta name="description" content="{{ config.site_description }}">
{% endif %}
{% if page.canonical_url %}
<link rel="canonical" href="{{ page.canonical_url }}">
{% endif %}
{% if config.site_author %}
<meta name="author" content="{{ config.site_author }}">
{% endif %}
{% if config.site_favicon %}
<link rel="shortcut icon" href="{{ base_url }}/{{ config.site_favicon }}">
{% else %}
<title>{{ site_name }}</title>
<link rel="shortcut icon" href="{{ base_url }}/assets/images/favicon.ico">
{% endif %}
{% if page_description %}
<meta name="description" content="{{ page_description }}">
{% endif %}
{% if canonical_url %}
<link rel="canonical" href="{{ canonical_url }}">
{% endif %}
{% if site_author %}
<meta name="author" content="{{ site_author }}">
<meta name="generator" content="mkdocs+mkdocs-material#1.0.0">
{% endblock %}
{% block htmltitle %}
{% if page.title %}
<title>{{ page.title }} - {{ config.site_name }}</title>
{% elif config.site_description %}
<title>{{ config.site_name }} - {{ config.site_description }}</title>
{% else %}
<title>{{ config.site_name }}</title>
{% endif %}
{% endblock %}
<meta property="og:url" content="{{ canonical_url }}">
<meta property="og:title" content="{{ site_name }}">
<meta property="og:image" content="{{ canonical_url }}/{{ base_url }}/{{ config.extra.logo }}">
<meta name="apple-mobile-web-app-title" content="{{ site_name }}">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
{% if config.extra.logo %}
<link rel="apple-touch-icon" href="{{ base_url }}/{{ config.extra.logo }}">
{% endif %}
{% set favicon = favicon | default("assets/images/favicon-e565ddfa3b.ico", true) %}
<link rel="shortcut icon" type="image/x-icon" href="{{ base_url }}/{{ favicon }}">
<link rel="icon" type="image/x-icon" href="{{ base_url }}/{{ favicon }}">
<style>
@font-face {
font-family: 'Icon';
src: url('{{ base_url }}/assets/fonts/icon.eot?52m981');
src: url('{{ base_url }}/assets/fonts/icon.eot?#iefix52m981')
format('embedded-opentype'),
url('{{ base_url }}/assets/fonts/icon.woff?52m981')
format('woff'),
url('{{ base_url }}/assets/fonts/icon.ttf?52m981')
format('truetype'),
url('{{ base_url }}/assets/fonts/icon.svg?52m981#icon')
format('svg');
font-weight: normal;
font-style: normal;
}
</style>
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-e576885f03.css">
{% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/palettes-2d6c5d2926.css">
{% endif %}
{% if config.extra.font != "none" %}
{% set text = config.extra.get("font", {}).text | default("Ubuntu") %}
{% set code = config.extra.get("font", {}).code | default("Ubuntu Mono") %}
{% set font = text + ':400,700|' + code | replace(' ', '+') %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ font }}">
<style>
body, input {
font-family: '{{ text }}', Helvetica, Arial, sans-serif;
}
pre, code {
font-family: '{{ code }}', 'Courier New', 'Courier', monospace;
}
</style>
{% endif %}
{% for path in extra_css %}
<link rel="stylesheet" href="{{ path }}">
{% endfor %}
<script src="{{ base_url }}/assets/javascripts/modernizr-2216498cab.js"></script>
{% block libs %}
<script src="{{ base_url }}/assets/javascripts/modernizr-9f4ef1018a.js"></script>
{% endblock %}
{% block fonts %}
{% include "partials/fonts.html" %}
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-ff220fd69d.css">
{% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-02ce7adcc2.palette.css">
{% endif %}
{% for path in extra_css %}
<link rel="stylesheet" href="{{ path }}">
{% endfor %}
{% endblock %}
{% block extrahead %}{% endblock %}
</head>
{% set palette = config.extra.get("palette", {}) %}
{% set primary = palette.primary | replace(' ', '-') | lower %}
{% set accent = palette.accent | replace(' ', '-') | lower %}
<body class="{% if primary %}palette-primary-{{ primary }}{% endif %} {% if accent %}palette-accent-{{ accent }}{% endif %}">
{% if repo_name == "GitHub" and repo_url %}
{% set repo_id = repo_url | replace("https://github.com/", "") %}
{% if repo_id[-1:] == "/" %}
{% set repo_id = repo_id[:-1] %}
{% endif %}
{% endif %}
<div class="backdrop">
<div class="backdrop-paper"></div>
</div>
<input class="toggle" type="checkbox" id="toggle-drawer">
<input class="toggle" type="checkbox" id="toggle-search">
<label class="toggle-button overlay" for="toggle-drawer"></label>
<header class="header">
{% include "header.html" %}
</header>
<main class="main">
{% set h1 = "\x3ch1 id=" in content %}
<div class="drawer">
{% include "drawer.html" %}
</div>
<article class="article">
<div class="wrapper">
{% if not h1 %}
<h1>{{ page_title | default(site_name, true)}}</h1>
{% endif %}
{{ content }}
<aside class="copyright" role="note">
{% if copyright %}
{{ copyright }} &ndash;
{% set primary = palette.primary | replace(" ", "-") | lower %}
{% set accent = palette.accent | replace(" ", "-") | lower %}
{% if primary or accent %}
<body data-md-color-primary="{{ primary }}" data-md-color-accent="{{ accent }}">
{% else %}
<body>
{% endif %}
{% include "partials/svgs.html" %}
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search">
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
{% block header %}
{% include "partials/header.html" %}
{% endblock %}
<div class="md-container">
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
{% block site_nav %}
{% if nav %}
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{% include "partials/nav.html" %}
</div>
</div>
</div>
{% endif %}
{% if page.toc %}
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
{% include "partials/toc.html" %}
</div>
</div>
</div>
{% endif %}
Documentation built with
<a href="http://www.mkdocs.org" target="_blank">MkDocs</a>
using the
<a href="http://squidfunk.github.io/mkdocs-material/" target="_blank">
Material
</a>
theme.
</aside>
{% block footer %}
<footer class="footer">
{% include "footer.html" %}
</footer>
{% endblock %}
</div>
</article>
<div class="results" role="status" aria-live="polite">
<div class="scrollable">
<div class="wrapper">
<div class="meta"></div>
<div class="list"></div>
<div class="md-content">
<article class="md-content__inner md-typeset">
{% if config.edit_uri %}
<a href="{{ page.edit_url }}" title="{{ i18n.t('edit.link.title') }}" class="md-icon md-content__edit">edit</a>
{% endif %}
{% block content %}
{% if not "\x3ch1 id=" in page.content %}
<h1>{{ page.title | default(config.site_name, true)}}</h1>
{% endif %}
{{ page.content }}
{% endblock %}
</article>
</div>
</div>
</div>
</main>
<script>
var base_url = '{{ base_url }}';
var repo_id = '{{ repo_id }}';
</script>
<script src="{{ base_url }}/assets/javascripts/application-82b5011116.js"></script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% endfor %}
{% if google_analytics %}
<script>
(function(i,s,o,g,r,a,m){
i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||
[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;
m.parentNode.insertBefore(a,m)
})(window, document,
'script', 'https://www.google-analytics.com/analytics.js', 'ga');
/* General initialization */
ga('create', '{{ google_analytics[0] }}', '{{ google_analytics[1] }}');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
/* Track outbound links */
var buttons = document.querySelectorAll('a');
Array.prototype.map.call(buttons, function(item) {
if (item.host != document.location.host) {
item.addEventListener('click', function() {
var action = item.getAttribute('data-action') || 'follow';
ga('send', 'event', 'outbound', action, item.href);
});
}
});
/* Register handler to log search on blur */
var query = document.querySelector('.query');
query.addEventListener('blur', function() {
if (this.value) {
var path = document.location.pathname;
ga('send', 'pageview', path + '?q=' + this.value);
}
});
</script>
{% endif %}
</main>
{% block footer %}
{% include "partials/footer.html" %}
{% endblock %}
</div>
{% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-ca9b3745c3.js"></script>
<script>var config={url:{base:"{{ base_url }}"}},app=new Application(config);app.initialize()</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>
{% endfor %}
{% endblock %}
{% block analytics %}
{% if config.google_analytics %}
<script>!function(e,t,a,n,o,c,i){e.GoogleAnalyticsObject=o,e[o]=e[o]||function(){(e[o].q=e[o].q||[]).push(arguments)},e[o].l=1*new Date,c=t.createElement(a),i=t.getElementsByTagName(a)[0],c.async=1,c.src=n,i.parentNode.insertBefore(c,i)}(window,document,"script","https://www.google-analytics.com/analytics.js","ga"),ga("create","{{ config.google_analytics[0] }}","{{ config.google_analytics[1] }}"),ga("set","anonymizeIp",!0),ga("send","pageview");var links=document.getElementsByTagName("a");Array.prototype.map.call(links,function(e){e.host!=document.location.host&&e.addEventListener("click",function(){var t=e.getAttribute("data-md-action")||"follow";ga("send","event","outbound",t,e.href)})});var query=document.forms.search.query;query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})</script>
{% endif %}
{% endblock %}
</body>
</html>
</html>

View File

@ -1,81 +0,0 @@
<nav aria-label="Navigation">
{% set home = repo_url | default("/", true) %}
<a href="{{ home }}" class="project">
<div class="banner">
{% if config.extra.logo %}
<div class="logo">
<img src="{{ base_url }}/{{ config.extra.logo }}">
</div>
{% endif %}
<div class="name">
<strong>
{{ site_name }}
<span class="version">
{{ config.extra.version }}
</span>
</strong>
{% if repo_id %}
<br>
{{ repo_id }}
{% endif %}
</div>
</div>
</a>
<div class="scrollable">
<div class="wrapper">
{% if repo_name == "GitHub" and repo_url %}
<ul class="repo">
<li class="repo-download">
{% if config.extra.github and config.extra.github.download_release %}
{% set version = config.extra.version | default("../latest") %}
<a href="{{ repo_url }}/releases/tag/{{ version }}" target="_blank" title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% else %}
{% set version = config.extra.version | default("master") %}
<a href="{{ repo_url }}/archive/{{ version }}.zip" target="_blank" title="Download" data-action="download">
<i class="icon icon-download"></i> Download
</a>
{% endif %}
</li>
<li class="repo-stars">
<a href="{{ repo_url }}/stargazers" target="_blank" title="Stargazers" data-action="star">
<i class="icon icon-star"></i> Stars
<span class="count">&ndash;</span>
</a>
</li>
</ul>
<hr>
{% endif %}
<div class="toc">
<ul>
{% for nav_item in nav %}
{% include "nav.html" %}
{% endfor %}
</ul>
{% if config.extra.author %}
<hr>
<span class="section">The author</span>
<ul>
{% if config.extra.author.twitter %}
{% set author = config.extra.author.twitter %}
<li>
<a href="https://twitter.com/{{ author }}" target="_blank" title="@{{ author }} on Twitter">
@{{ author }} on Twitter
</a>
</li>
{% endif %}
{% if config.extra.author.github %}
{% set author = config.extra.author.github %}
<li>
<a href="https://github.com/{{ author }}" target="_blank" title="@{{ author }} on GitHub">
@{{ author }} on GitHub
</a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
</div>
</div>
</nav>

View File

@ -1,42 +0,0 @@
{% if include_next_prev %}
<nav class="pagination" aria-label="Footer">
<div class="previous">
{% if previous_page %}
<a href="{{ previous_page.url }}" title="{{ previous_page.title }}">
<span class="direction">
{{ config.extra.get("i18n", {}).prev | default("Previous") }}
</span>
<div class="page">
<div class="button button-previous" role="button" aria-label="Previous">
<i class="icon icon-back"></i>
</div>
<div class="stretch">
<div class="title">
{{ previous_page.title }}
</div>
</div>
</div>
</a>
{% endif %}
</div>
<div class="next">
{% if next_page %}
<a href="{{ next_page.url }}" title="{{ next_page.title }}">
<span class="direction">
{{ config.extra.get("i18n", {}).next | default("Next") }}
</span>
<div class="page">
<div class="stretch">
<div class="title">
{{ next_page.title }}
</div>
</div>
<div class="button button-next" role="button" aria-label="Next">
<i class="icon icon-forward"></i>
</div>
</div>
</a>
{% endif %}
</div>
</nav>
{% endif %}

View File

@ -1,54 +0,0 @@
<nav aria-label="Header">
<div class="bar default">
<div class="button button-menu" role="button" aria-label="Menu">
<label class="toggle-button icon icon-menu" for="toggle-drawer">
<span></span>
</label>
</div>
<div class="stretch">
<div class="title">
{% if current_page %}
<span class="path">
{% for doc in current_page.ancestors %}
{% if doc.link %}
<a href="{{ doc.link | e }}">{{ doc.title }}</a>
<i class="icon icon-link"></i>
{% else %}
{{ doc.title }} <i class="icon icon-link"></i>
{% endif %}
{% endfor %}
</span>
{% endif %}
{{ page_title | default(site_name, true) }}
</div>
</div>
{% if config.extra.get("author", {}).twitter %}
{% set author = config.extra.author.twitter %}
<div class="button button-twitter" role="button" aria-label="Twitter">
<a href="https://twitter.com/{{ author }}" title="@{{ author }} on Twitter" target="_blank" class="toggle-button icon icon-twitter"></a>
</div>
{% endif %}
{% if config.extra.get("author", {}).github %}
{% set author = config.extra.author.github %}
<div class="button button-github" role="button" aria-label="GitHub">
<a href="https://github.com/{{ author }}" title="@{{ author }} on GitHub" target="_blank" class="toggle-button icon icon-github"></a>
</div>
{% endif %}
<div class="button button-search" role="button" aria-label="Search">
<label class="toggle-button icon icon-search" title="Search" for="toggle-search"></label>
</div>
</div>
<div class="bar search">
<div class="button button-close" role="button" aria-label="Close">
<label class="toggle-button icon icon-back" for="toggle-search"></label>
</div>
<div class="stretch">
<div class="field">
<input class="query" type="text" placeholder="{{ config.extra.get('i18n', {}).search | default('Search') }}" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false">
</div>
</div>
<div class="button button-reset" role="button" aria-label="{{ config.extra.get('i18n', {}).search | default('Search') }}">
<button class="toggle-button icon icon-close" id="reset-search"></button>
</div>
</div>
</nav>

1
material/main.html Normal file
View File

@ -0,0 +1 @@
{% extends "base.html" %}

View File

@ -1,7 +0,0 @@
{
"assets/images/favicon.ico": "assets/images/favicon-e565ddfa3b.ico",
"assets/javascripts/application.js": "assets/javascripts/application-82b5011116.js",
"assets/javascripts/modernizr.js": "assets/javascripts/modernizr-2216498cab.js",
"assets/stylesheets/application.css": "assets/stylesheets/application-e576885f03.css",
"assets/stylesheets/palettes.css": "assets/stylesheets/palettes-2d6c5d2926.css"
}

View File

@ -1,32 +0,0 @@
{% if nav_item.children %}
<li>
<span class="section">{{ nav_item.title }}</span>
<ul>
{% for nav_item in nav_item.children %}
{% include "nav.html" %}
{% endfor %}
</ul>
</li>
{% else %}
<li>
<a class="{% if nav_item.active %}current{% endif %}" title="{{ nav_item.title }}" href="{{ nav_item.url }}">
{{ nav_item.title }}
</a>
{% if nav_item == current_page %}
{% if h1 %}
{% set toc = (toc | first).children %}
{% endif %}
{% if toc and (toc | first) %}
<ul>
{% for toc_item in toc %}
<li class="anchor">
<a title="{{ toc_item.title }}" href="{{ toc_item.url }}">
{{ toc_item.title }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
</li>
{% endif %}

View File

@ -0,0 +1,8 @@
{% if config.extra.font != "none" %}
{% set text = config.extra.get("font", {}).text | default("Roboto") %}
{% set code = config.extra.get("font", {}).code | default("Roboto Mono") %}
{% set font = text + ':300,400,400i,700|' + code | replace(' ', '+') %}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family={{ font }}">
<style>body,input{font-family:"{{ text }}","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"{{ code }}","Courier New",Courier,monospace}</style>
{% endif %}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

View File

@ -0,0 +1,58 @@
{% import "partials/i18n.html" as i18n %}
<footer class="md-footer">
{% if page.previous_page or page.next_page %}
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
{% if page.previous_page %}
<a href="{{ page.previous_page.url }}" title="{{ page.previous_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__icon"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
{{ i18n.t('footer.previous') }}
</span>
{{ page.previous_page.title }}
</span>
</div>
</a>
{% endif %}
{% if page.next_page %}
<a href="{{ page.next_page.url }}" title="{{ page.next_page.title }}" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
{{ i18n.t('footer.next') }}
</span>
{{ page.next_page.title }}
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__icon"></i>
</div>
</a>
{% endif %}
</nav>
</div>
{% endif %}
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
{% if config.copyright %}
<div class="md-footer-copyright__highlight">
{{ config.copyright }}
</div>
{% endif %}
powered by
<a href="http://www.mkdocs.org" title="MkDocs">MkDocs</a>
and
<a href="http://squidfunk.github.io/mkdocs-material/" title="Material for MkDocs">
Material for MkDocs</a>
</div>
{% block social %}
{% include "partials/social.html" %}
{% endblock %}
</div>
</div>
</footer>

View File

@ -0,0 +1,43 @@
<header class="md-header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="{{ nav.homepage.url }}" title="{{ config.site_name }}" class="md-icon {% if not config.extra.logo %} md-icon--home {% endif %} md-header-nav__icon">
{% if config.extra.logo %}
<img src="{{ base_url }}/{{ config.extra.logo }}" width="24" height="24">
{% endif %}
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__icon" for="drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<span class="md-flex__ellipsis md-header-nav__title">
{% block site_name %}
{% if page %}
{% for parent in page.ancestors %}
<span class="md-header-nav__parent">
{{ parent.title }}
</span>
{% endfor %}
{% endif %}
{{ page.title | default(config.site_name, true) }}
{% endblock %}
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
{% block search_box %}
<label class="md-icon md-icon--search md-header-nav__icon" for="search"></label>
{% include "partials/search.html" %}
{% endblock %}
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
{% if config.repo_url %}
{% include "partials/source.html" %}
{% endif %}
</div>
</div>
</div>
</nav>
</header>

View File

@ -0,0 +1,8 @@
{% macro t(key) %}{{ {
"edit.link.title": "Edit this page",
"footer.previous": "Previous",
"footer.next": "Next",
"search.placeholder": "Search",
"source.link.title": "Go to repository",
"toc.title": "Table of contents"
}[key] }}{% endmacro %}

View File

@ -0,0 +1,55 @@
{% if nav_item.children %}
<li class="md-nav__item md-nav__item--nested">
{% if nav_item.active %}
<input class="md-toggle md-nav__toggle" data-md-toggle="{{ path }}" type="checkbox" id="{{ path }}" checked>
{% else %}
<input class="md-toggle md-nav__toggle" data-md-toggle="{{ path }}" type="checkbox" id="{{ path }}">
{% endif %}
<label class="md-nav__link" for="{{ path }}">
{{ nav_item.title }}
</label>
<nav class="md-nav" data-md-component="collapsible">
<label class="md-nav__title" for="{{ path }}">
{{ nav_item.title}}
</label>
<ul class="md-nav__list" data-md-scrollfix>
{% set base = path %}
{% for nav_item in nav_item.children %}
{% set path = base + "-" + loop.index | string %}
{% include "partials/nav-item.html" %}
{% endfor %}
</ul>
</nav>
</li>
{% elif nav_item == page %}
<li class="md-nav__item">
{% set toc_ = page.toc %}
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
{% if "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
{% if toc_ and (toc_ | first) %}
<label class="md-nav__link md-nav__link--active" for="toc">
{{ nav_item.title }}
</label>
{% endif %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
{% if page.toc %}
{% include "partials/toc.html" %}
{% endif %}
</li>
{% else %}
<li class="md-nav__item">
{% if nav_item.active %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link md-nav__link--active">
{{ nav_item.title }}
</a>
{% else %}
<a href="{{ nav_item.url }}" title="{{ nav_item.title }}" class="md-nav__link">
{{ nav_item.title }}
</a>
{% endif %}
</li>
{% endif %}

View File

@ -0,0 +1,21 @@
<nav class="md-nav md-nav--primary">
<label class="md-nav__title md-nav__title--site" for="drawer">
<i class="md-icon {% if not config.extra.logo %} md-icon--home {% endif %} md-nav__icon">
{% if config.extra.logo %}
<img src="{{ base_url }}/{{ config.extra.logo }}">
{% endif %}
</i>
{{ config.site_name }}
</label>
{% if config.repo_url %}
<div class="md-nav__source">
{% include "partials/source.html" %}
</div>
{% endif %}
<ul class="md-nav__list" data-md-scrollfix>
{% for nav_item in nav %}
{% set path = "nav-" + loop.index | string %}
{% include "partials/nav-item.html" %}
{% endfor %}
</ul>
</nav>

View File

@ -0,0 +1,15 @@
{% import "partials/i18n.html" as i18n %}
<div class="md-search" data-md-component="search">
<div class="md-search__overlay"></div>
<div class="md-search__inner">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="{{ i18n.t('search.placeholder') }}" accesskey="s" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false">
<label class="md-icon md-search__icon" for="search"></label>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result"></div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,9 @@
{% if config.extra.social %}
<div class="md-footer-social">
{% set path = "ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/{{ path }}">
{% for social in config.extra.social %}
<a href="{{ social.link }}" class="md-footer-social__link fa fa-{{ social.type }}"></a>
{% endfor %}
</div>
{% endif %}

View File

@ -0,0 +1,25 @@
{% import "partials/i18n.html" as i18n %}
{% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %}
{% set repo_type = "github" %}
{% elif "gitlab" in platform %}
{% set repo_type = "gitlab" %}
{% elif "bitbucket" in platform %}
{% set repo_type = "bitbucket" %}
{% else %}
{% set repo_type = "" %}
{% endif %}
{% block repo %}
<a href="{{ config.repo_url }}" title="{{ i18n.t('source.link.title') }}" class="md-source" data-md-source="{{ repo_type }}">
{% if repo_type %}
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#{{ repo_type }}" width="24" height="24"></use>
</svg>
</div>
{% endif %}
<div class="md-source__repository">
{{ config.repo_name }}
</div>
</a>
{% endblock %}

View File

@ -0,0 +1,10 @@
<div class="md-svg">
{% set platform = config.extra.repo_icon or config.repo_url %}
{% if "github" in platform %}
{% include "assets/images/icons/github-1da075986e.svg" %}
{% elif "gitlab" in platform %}
{% include "assets/images/icons/gitlab-5ad3f9f9e5.svg" %}
{% elif "bitbucket" in platform %}
{% include "assets/images/icons/bitbucket-670608a71a.svg" %}
{% endif %}
</div>

View File

@ -0,0 +1,14 @@
<li class="md-nav__item">
<a href="{{ toc_item.url }}" title="{{ toc_item.title }}" class="md-nav__link">
{{ toc_item.title }}
</a>
{% if toc_item.children %}
<nav class="md-nav">
<ul class="md-nav__list">
{% for toc_item in toc_item.children %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>
</nav>
{% endif %}
</li>

View File

@ -0,0 +1,15 @@
{% import "partials/i18n.html" as i18n %}
<nav class="md-nav md-nav--secondary">
{% set toc_ = page.toc %}
{% if "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %}
{% endif %}
{% if toc_ and (toc_ | first) %}
<label class="md-nav__title" for="toc">{{ i18n.t('toc.title') }}</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>
{% endif %}
</nav>

View File

@ -1,4 +1,4 @@
# Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
@ -19,41 +19,67 @@
# IN THE SOFTWARE.
# Project information
site_name: Material
site_description: A material design theme for MkDocs
site_name: Material for MkDocs
site_description: A Material Design theme for MkDocs
site_author: Martin Donath
site_url: http://squidfunk.github.io/mkdocs-material/
# Repository
repo_name: GitHub
repo_name: squidfunk/mkdocs-material
repo_url: https://github.com/squidfunk/mkdocs-material
# Copyright
copyright: Copyright (c) 2016 Martin Donath
copyright: 'Copyright &copy; 2016 Martin Donath'
# Documentation and theme
theme_dir: material
# Options
extra:
version: 0.2.4
logo: images/logo.png
github:
download_release: true
author:
github: squidfunk
twitter: squidfunk
palette:
primary: indigo
accent: indigo
social:
- type: github-alt
link: https://github.com/squidfunk
- type: twitter
link: https://twitter.com/squidfunk
- type: linkedin
link: https://de.linkedin.com/in/martin-donath-20a95039
# Extensions
markdown_extensions:
- codehilite(css_class=code)
- admonition
- toc:
permalink: '#'
- markdown.extensions.admonition
- markdown.extensions.codehilite(guess_lang=false)
- markdown.extensions.footnotes
- markdown.extensions.meta
- markdown.extensions.toc(permalink=true)
- pymdownx.arithmatex
- pymdownx.betterem(smart_enable=all)
- pymdownx.caret
- pymdownx.critic
- pymdownx.emoji:
emoji_generator: !!python/name:pymdownx.emoji.to_svg
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.superfences
- pymdownx.tasklist(custom_checkbox=true)
- pymdownx.tilde
# Page tree
pages:
- Material: index.md
- Getting started: getting-started.md
- Extensions:
- Admonition: extensions/admonition.md
- CodeHilite: extensions/codehilite.md
- Footnotes: extensions/footnotes.md
- Permalinks: extensions/permalinks.md
- PyMdown: extensions/pymdown.md
- Specimen: specimen.md
- Customization: customization.md
- License: license.md
- Release notes: release-notes.md
- Contributing: contributing.md
- License: license.md

View File

@ -1,45 +1,103 @@
{
"name": "mkdocs-material",
"version": "0.2.4",
"description": "A material design theme for MkDocs",
"homepage": "http://squidfunk.github.io/mkdocs-material/",
"authors": [
"squidfunk <martin.donath@squidfunk.com>"
"version": "1.0.0",
"description": "A Material Design theme for MkDocs",
"keywords": [
"mkdocs",
"documentation",
"theme"
],
"license": "MIT",
"main": "Gulpfile.js",
"scripts": {
"start": "gulp watch"
"homepage": "http://squidfunk.github.io/mkdocs-material/",
"bugs": {
"url": "https://github.com/squidfunk/mkdocs-material/issues",
"email": "martin.donath@squidfunk.com"
},
"license": "MIT",
"author": {
"name": "Martin Donath",
"email": "martin.donath@squidfunk.com"
},
"contributors": [],
"repository": {
"type": "git",
"url": "https://github.com/squidfunk/mkdocs-material.git"
},
"private": true,
"scripts": {
"build": "scripts/build",
"clean": "scripts/clean",
"lint": "scripts/lint",
"start": "scripts/start",
"test": "scripts/test"
},
"dependencies": {},
"devDependencies": {
"autoprefixer": "^6.3.2",
"babel-eslint": "^6.1.2",
"babel-loader": "^6.2.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-transform-react-jsx": "^6.8.0",
"babel-polyfill": "^6.20.0",
"babel-preset-es2015": "^6.13.2",
"babel-register": "^6.16.3",
"babel-root-import": "^4.1.3",
"chai": "^3.5.0",
"core-js": "^2.4.1",
"css-mqpacker": "^5.0.1",
"custom-event-polyfill": "^0.3.0",
"del": "^2.2.0",
"eslint": "^3.6.1",
"eslint-plugin-mocha": "^4.6.0",
"fastclick": "^1.0.6",
"git-hooks": "^1.1.6",
"gulp": "^3.9.1",
"gulp-add-src": "^0.2.0",
"gulp-changed": "^1.3.2",
"gulp-concat": "^2.6.0",
"gulp-cssnano": "^2.1.1",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.0",
"gulp-ignore": "^2.0.1",
"gulp-image-optimization": "^0.1.3",
"gulp-modernizr": "0.0.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^6.1.0",
"gulp-remove-empty-lines": "0.0.8",
"gulp-replace": "^0.5.4",
"gulp-rev": "^7.0.0",
"gulp-rev-collector": "^1.0.2",
"gulp-rev-replace": "^0.4.3",
"gulp-sass": "^3.0.0",
"gulp-sourcemaps": "^2.2.2",
"gulp-stylelint": "^3.7.0",
"gulp-svgmin": "^1.2.2",
"gulp-uglify": "^2.0.0",
"gulp-util": "^3.0.7",
"js-cookie": "^2.1.3",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.2.0",
"karma-notify-reporter": "^1.0.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.26",
"karma-webpack": "^1.8.0",
"lunr": "^0.7.1",
"material-design-color": "^2.3.1",
"material-shadows": "^3.0.0",
"mocha": "^3.1.0",
"modularscale-sass": "^2.1.1",
"node-notifier": "^4.5.0",
"selenium-standalone": "^5.7.2",
"stylelint": "^7.7.1",
"stylelint-config-standard": "^15.0.1",
"stylelint-order": "^0.2.2",
"stylelint-scss": "^1.4.1",
"through2": "^2.0.1",
"vinyl-paths": "^2.1.0",
"webpack": "^1.13.1",
"webpack-stream": "^3.2.0",
"whatwg-fetch": "^1.0.0",
"yargs": "^6.6.0"
}
},
"engines": {
"node": ">= 4.5.0"
},
"private": true
}

23
requirements.txt Normal file
View File

@ -0,0 +1,23 @@
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
mkdocs>=0.16
pygments
pymdown-extensions

31
scripts/build Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Check if "npm install" was executed
if [[ ! -d `npm bin` ]]; then
echo "\"node_modules\" not found:"
echo "npm install"
exit 1
fi
# Run command
`npm bin`/gulp build --clean --optimize --revision

31
scripts/clean Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Check if "npm install" was executed
if [[ ! -d `npm bin` ]]; then
echo "\"node_modules\" not found:"
echo "npm install"
exit 1
fi
# Run command
`npm bin`/gulp clean

44
scripts/lint Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Check if "npm install" was executed
if [[ ! -d `npm bin` ]]; then
echo "\"node_modules\" not found:"
echo "npm install"
exit 1
fi
# Run ESLint
`npm bin`/eslint .
ESLINT=$?
# Run Stylelint
`npm bin`/stylelint `find src/assets -name *.scss`
STYLELINT=$?
# If one command failed, exit with error
if [ $ESLINT -gt 0 ] || [ $STYLELINT -gt 0 ]; then
exit 1
fi;
# Otherwise return with success
exit 0

31
scripts/start Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Check if "npm install" was executed
if [[ ! -d `npm bin` ]]; then
echo "\"node_modules\" not found:"
echo "npm install"
exit 1
fi
# Run command
`npm bin`/gulp watch --no-lint

31
scripts/test Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
# Check if "npm install" was executed
if [[ ! -d `npm bin` ]]; then
echo "\"node_modules\" not found:"
echo "npm install"
exit 1
fi
# Run command
`npm bin`/gulp test

View File

@ -1,4 +1,4 @@
# Copyright (c) 2016 Martin Donath <martin.donath@squidfunk.com>
# Copyright (c) 2016-2017 Martin Donath <martin.donath@squidfunk.com>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
@ -22,20 +22,20 @@ from setuptools import setup, find_packages
# Package description
setup(
name = 'mkdocs-material',
version = '0.2.4',
url = 'http://squidfunk.github.io/mkdocs-material/',
license = 'MIT',
description = 'A material design theme for MkDocs',
author = 'Martin Donath',
author_email = 'martin.donath@squidfunk.com',
keywords = ['mkdocs', 'documentation', 'theme'],
name = "mkdocs-material",
version = "1.0.0",
url = "http://squidfunk.github.io/mkdocs-material/",
license = "MIT",
description = "A Material Design theme for MkDocs",
author = "Martin Donath",
author_email = "martin.donath@squidfunk.com",
keywords = ["mkdocs", "documentation", "theme"],
packages = find_packages(),
include_package_data = True,
entry_points = {
'mkdocs.themes': [
'material = material',
"mkdocs.themes": [
"material = material",
]
},
zip_safe = False
)
)

Some files were not shown because too many files have changed in this diff Show More