Merge branch 'master' into chore/flow-type-checking

This commit is contained in:
squidfunk 2017-02-25 17:18:44 +01:00
commit c6e5159cc6
15 changed files with 484 additions and 1091 deletions

1
.gitignore vendored
View File

@ -24,6 +24,7 @@
# NPM-related
/node_modules
/npm-debug.log*
/yarn-error.log
# Files generated by build
/build

View File

@ -21,15 +21,82 @@
language: node_js
sudo: false
# -----------------------------------------------------------------------------
# Regular builds
# -----------------------------------------------------------------------------
# Node.js versions
node_js:
- 5
- 6
- 7
# Build visual tests separately - temporary disabled until tests are stable
# matrix:
# include:
# Limit clone depth to 5, to speed up build
git:
depth: 5
# Cache dependencies
cache:
pip: true
yarn: true
directories:
- node_modules
# Install yarn as Travis doesn't support it out of the box
before_install:
- npm install -g yarn
# Install dependencies
install:
- yarn install --ignore-optional
- pip install --user -r requirements.txt
# Perform build and tests
script:
- yarn run build
# -----------------------------------------------------------------------------
# Additional builds
# -----------------------------------------------------------------------------
# Matrix for additional builds
matrix:
include:
# Build release and docker image and send to PyPI and Docker Hub.
- node_js: 5
services:
- docker
env:
- __TASK=RELEASE
# If we're not on a release branch, exit early and indicate success
before_install:
- echo "$TRAVIS_BRANCH" | grep -qvE "^[0-9.]+$" && exit 0; :;
# Install wheel for build
install:
- pip install wheel
# Perform build
script:
- python setup.py build sdist bdist_wheel --universal
- docker build -t $TRAVIS_REPO_SLUG .
# If build was successful, publish
after_success:
# Install twine and push release to PyPI
- pip install twine
- twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD dist/*
# Push to Docker Hub
- docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker tag $TRAVIS_REPO_SLUG $TRAVIS_REPO_SLUG:$TRAVIS_BRANCH
- docker tag $TRAVIS_REPO_SLUG $TRAVIS_REPO_SLUG:latest
- docker push $TRAVIS_REPO_SLUG
# # Build visual tests separately - temporary disabled until tests stable
# - node_js: 5
# addons:
# artifacts:
@ -45,26 +112,3 @@ node_js:
# - CXX=g++-4.8
# install: yarn install
# script: yarn run test:visual:run
# Limit clone depth to 5, to speed up build
git:
depth: 5
# Cache dependencies
cache:
pip: true
yarn: true
directories:
- node_modules
# Install yarn as Travis doesn't support it out of the box
before_install: npm install -g yarn
# Do not install optional dependencies by default
install: yarn install --ignore-optional
# Install dependencies
before_script: pip install --user -r requirements.txt
# Perform build and tests
script: yarn run build

View File

@ -21,17 +21,30 @@
FROM jfloff/alpine-python:2.7-slim
MAINTAINER Martin Donath <martin.donath@squidfunk.com>
# Set working directory
WORKDIR /docs
# Set build directory
WORKDIR /tmp
# Install packages
# Install dependencies
COPY requirements.txt .
RUN \
pip install -r requirements.txt && \
pip install mkdocs-material && \
rm requirements.txt
# Expose MkDocs default port
# Copy files necessary for build
COPY material material
COPY MANIFEST.in MANIFEST.in
COPY package.json package.json
COPY setup.py setup.py
# Perform build and cleanup artifacts
RUN \
python setup.py install && \
rm -rf /tmp/*
# Set working directory
WORKDIR /docs
# Expose MkDocs development server port
EXPOSE 8000
# Start development server by default

View File

@ -1,21 +1,17 @@
[![Travis][travis-image]][travis-link]
[![Dependencies][deps-image]][deps-link]
[![Codacy][codacy-image]][codacy-link]
[![Docker][docker-image]][docker-link]
[![PyPI][pypi-image]][pypi-link]
[travis-image]: https://travis-ci.org/squidfunk/mkdocs-material.svg?branch=master
[travis-link]: https://travis-ci.org/squidfunk/mkdocs-material
[deps-image]: https://david-dm.org/squidfunk/mkdocs-material/dev-status.svg
[deps-link]: https://david-dm.org/squidfunk/mkdocs-material?type=dev
[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
[docker-image]: https://img.shields.io/docker/pulls/squidfunk/mkdocs-material.svg
[docker-image]: https://img.shields.io/docker/automated/squidfunk/mkdocs-material.svg
[docker-link]: https://hub.docker.com/r/squidfunk/mkdocs-material/
[pypi-image]: https://img.shields.io/pypi/v/mkdocs-material.svg
[pypi-link]: https://pypi.python.org/pypi/mkdocs-material
# Material for MkDocs
A Material Design theme for [MkDocs](http://www.mkdocs.org).

View File

@ -6,7 +6,7 @@
The official [Docker image][1] for Material comes with all dependencies
pre-installed and ready-to-use with the latest version published on PyPI,
packaged in a very small image (27MB compressed).
packaged in a very small image (28MB compressed).
### Installing MkDocs
@ -246,7 +246,7 @@ extra:
```
[12]: https://fonts.google.com/specimen/Roboto
[13]: https://fonts.google.com/
[13]: https://fonts.google.com
[14]: https://fonts.google.com/specimen/Ubuntu
### Adding a logo
@ -300,6 +300,21 @@ google_analytics:
- 'auto'
```
### Disqus integation
Material for MkDocs is integrated with [Disqus][16], so if you want to add a
comments section to your documentation set the shortname of your Disqus project
in your `mkdocs.yml`:
``` yaml
extra:
disqus: 'your-disqus-shortname'
```
The necessary JavaScript is automatically included.
[16]: https://disqus.com
### Localization <small>L10N</small>
In order to localize the labels (e.g. *Previous* and *Next* in the footer),
@ -309,6 +324,7 @@ translations inside the macro `t`:
``` jinja
{% macro t(key) %}{{ {
"edit.link.title": "Edit this page",
"comments": "Comments",
"footer.previous": "Previous",
"footer.next": "Next",
"search.placeholder": "Search",
@ -318,7 +334,7 @@ translations inside the macro `t`:
```
Just copy the file from the original theme and make your adjustments. See the
section on [overriding partials][16] in the customization guide.
section on [overriding partials][17] in the customization guide.
!!! warning "Migrating from Material 0.2.x"
@ -326,18 +342,18 @@ section on [overriding partials][16] in the customization guide.
`mkdocs.yml`. With 1.0.0 this is no longer possible as the configuration
will be ignored.
[16]: customization.md#overriding-partials
[17]: customization.md#overriding-partials
### More advanced customization
If you want to change the general appearance of the Material theme, see
[this article][17] for more information on advanced customization.
[this article][18] for more information on advanced customization.
[17]: customization.md
[18]: customization.md
## Extensions
MkDocs supports several [Markdown extensions][18]. The following extensions
MkDocs supports several [Markdown extensions][19]. 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:
@ -351,18 +367,18 @@ markdown_extensions:
For more information, see the following list of extensions supported by the
Material theme including more information regarding installation and usage:
* [Admonition][19]
* [Codehilite][20]
* [Permalinks][21]
* [Footnotes][22]
* [PyMdown Extensions][23]
* [Admonition][20]
* [Codehilite][21]
* [Permalinks][22]
* [Footnotes][23]
* [PyMdown Extensions][24]
[18]: http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
[19]: extensions/admonition.md
[20]: extensions/codehilite.md
[21]: extensions/permalinks.md
[22]: extensions/footnotes.md
[23]: extensions/pymdown.md
[19]: http://www.mkdocs.org/user-guide/writing-your-docs/#markdown-extensions
[20]: extensions/admonition.md
[21]: extensions/codehilite.md
[22]: extensions/permalinks.md
[23]: extensions/footnotes.md
[24]: extensions/pymdown.md
## Full example
@ -380,7 +396,7 @@ repo_name: 'GitHub'
repo_url: 'https://github.com/my-github-handle/my-project'
# Copyright
copyright: 'Copyright &copy; 2016 John Doe'
copyright: 'Copyright &copy; 2016 - 2017 John Doe'
# Documentation and theme
theme: 'material'
@ -394,13 +410,14 @@ extra:
font:
text: 'Roboto'
code: 'Roboto Mono'
disqus: 'your-disqus-shortname'
social:
- type: 'github'
link: 'https://github.com/squidfunk'
link: 'https://github.com/john-doe'
- type: 'twitter'
link: 'https://twitter.com/squidfunk'
link: 'https://twitter.com/jonh-doe'
- type: 'linkedin'
link: 'https://de.linkedin.com/in/martin-donath-20a95039'
link: 'https://de.linkedin.com/in/john-doe'
# Google Analytics
google_analytics:

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -34,7 +34,7 @@
<script src="{{ base_url }}/assets/javascripts/modernizr-56ade86843.js"></script>
{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-4b280ca4d9.css">
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-a7dac97dbb.css">
{% if config.extra.palette %}
<link rel="stylesheet" href="{{ base_url }}/assets/stylesheets/application-02ce7adcc2.palette.css">
{% endif %}
@ -115,6 +115,23 @@
{% endif %}
{{ page.content }}
{% endblock %}
{% if config.extra.disqus and not page.is_homepage %}
<h2>{{ lang.t('comments') }}</h2>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ page.canonical_url }}";
this.page.identifier =
"{{ page.canonical_url | replace(config.site_url, "") }}";
};
(function() {
var d = document, s = d.createElement("script");
s.src = "//{{ config.extra.disqus }}.disqus.com/embed.js";
s.setAttribute("data-timestamp", +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
{% endif %}
</article>
</div>
</div>
@ -124,7 +141,7 @@
{% endblock %}
</div>
{% block scripts %}
<script src="{{ base_url }}/assets/javascripts/application-3fa7d77989.js"></script>
<script src="{{ base_url }}/assets/javascripts/application-8dc3dfc020.js"></script>
<script>app.initialize({url:{base:"{{ base_url }}"}})</script>
{% for path in extra_javascript %}
<script src="{{ path }}"></script>

View File

@ -1,5 +1,6 @@
{% macro t(key) %}{{ {
"edit.link.title": "Edit this page",
"comments": "Comments",
"footer.previous": "Previous",
"footer.next": "Next",
"search.placeholder": "Search",

View File

@ -50,14 +50,17 @@ function initialize(config) { // eslint-disable-line func-style
/* Wrap all data tables for better overflow scrolling */
const tables = document.querySelectorAll("table:not([class])")
Array.prototype.forEach.call(tables, table => {
const wrap = document.createElement("div")
wrap.classList.add("md-typeset__table")
const wrap = (
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table"></div>
</div>
)
if (table.nextSibling) {
table.parentNode.insertBefore(wrap, table.nextSibling)
} else {
table.parentNode.appendChild(wrap)
}
wrap.appendChild(table)
wrap.children[0].appendChild(table)
})
/* Force 1px scroll offset to trigger overflow scrolling */

View File

@ -367,18 +367,18 @@ kbd {
table:not([class]) {
@include z-depth(2);
margin: 2em 0;
border-radius: 0.2rem;
font-size: ms(-1);
overflow: hidden;
// Semi-cool overflow solution, in case JavaScript is not available
.no-js & {
display: inline-block;
max-width: 100%;
margin: 0.8em 0;
border-radius: 0.2rem;
font-size: ms(-1);
overflow: auto;
-webkit-overflow-scrolling: touch;
// Due to margin collapse because of the necessary inline-block hack, we
// cannot increase the bottom margin on the table, so we just increase the
// top margin on the following element
& + * {
margin-top: 1.5em;
}
// Table headings and cells
@ -414,16 +414,25 @@ kbd {
}
}
// Data table wrapper, in case JavaScript is available
.md-typeset__table {
margin: 1.6em -1.6rem;
// Wrapper for scrolling on overflow
&__scrollwrap {
margin: 1em -1.6rem;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
// Data table wrapper, in case JavaScript is available
.md-typeset__table {
display: inline-block;
margin-bottom: 0.5em;
padding: 0 1.6rem;
// Data tables
table {
display: inline-block;
margin: 0 1.6rem;
display: table;
width: 100%;
margin: 0;
overflow: hidden;
}
}
}

View File

@ -230,6 +230,25 @@
<!-- Content -->
{{ page.content }}
{% endblock %}
<!-- Disqus integration -->
{% if config.extra.disqus and not page.is_homepage %}
<h2>{{ lang.t('comments') }}</h2>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ page.canonical_url }}";
this.page.identifier =
"{{ page.canonical_url | replace(config.site_url, "") }}";
};
(function() {
var d = document, s = d.createElement("script");
s.src = "//{{ config.extra.disqus }}.disqus.com/embed.js";
s.setAttribute("data-timestamp", +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
{% endif %}
</article>
</div>
</div>

View File

@ -23,6 +23,7 @@
<!-- Translations -->
{% macro t(key) %}{{ {
"edit.link.title": "Edit this page",
"comments": "Comments",
"footer.previous": "Previous",
"footer.next": "Next",
"search.placeholder": "Search",

1292
yarn.lock

File diff suppressed because it is too large Load Diff