The website for Das Keyboard.
We welcome contributions and feedback on our website! Please file a request in our issue tracker and we'll take a look.
A tldr version follows:
-
Ensure you have Ruby installed; you need version 2.2.2 or later:
ruby --version
-
Ensure you have Bundler installed; if not install with:
gem install bundler
-
Install all dependencies:
bundle install
-
Create a branch.
-
Make your changes.
-
Test your changes by serving the site locally:
bundle exec jekyll serve
(orjekyll serve -w --force_polling
) -
Prior to submitting, run link validation:
rake checklinks
If you have a document that spans multiple pages, you can add next and previous page links to make navigating these pages easier. It involves adding some information to the front matter of each page, and including some HTML.
---
layout: tutorial
title: "Constraints"
permalink: /tutorials/layout/constraints.html
prev-page: /tutorials/layout/properties.html
prev-page-title: "Container Properties"
next-page: /tutorials/layout/create.html
next-page-title: "Create a Layout"
---
{% include prev-next-nav.html %}
{:toc}
<!-- PAGE CONTENT -->
{% include prev-next-nav.html %}
Omit the "prev-page" info for the first page, and the "next-page" info for the last page.
The website uses prism.js for syntax highlighting. This section covers how to use syntax highlighting, and how to update our syntax highlighter for new languages.
This website can syntax highlight the following languages:
- shell
- dart
- html
- css
- javascript
- java
- objectivec
- swift
- go
- php
- python
- ruby
The easiest way to syntax highlight a block of code is to wrap it with triple backticks followed by the language.
Here's an example:
```dart
class SomeCode {
String name;
}
```
See the list of supported languages above for what to use following the first triple backticks.
The website uses a custom build of prism, which includes only the languages the website requires. To improve load times and user experience, we do not support every language that prism supports.
To add a new language for syntax highlighting, you will need
to generate a new copy of the prism.js
file.
Follow these steps to generate a new copy of prism.js
:
- Open
js/prism.js
- Copy the URL in the comment of the first line of the file
- Paste it into a browser window/tab
- Add the new language that you wish to syntax highlight
- DO NOT change the other plugins, languages, or settings
- Download the generated JavaScript, and use it to replace
js/prism.js
- Download the generated CSS, and use it to replace
_sass/_prism.scss
You can include a specific range of lines from a file:
{% include includelines filename=PATH start=INT count=INT %}
PATH
must be inside of _include
. If you are including source code,
place that code into _include/code
to follow our convention.
The code snippets in the markdown documentation are validated as part of the build process. Anything within a '```dart' code fence will be extracted into its own file and checked for analysis issues. Some ways to tweak that:
- If a code snippet should not be analyzed, immediately proceed it with
a
<!-- skip -->
comment - To include code to be analyzed, but not displayed, add that in a comment
immediately proceeding the snippet (e.g.,
<!-- someCodeHere(); -->
) - A snippet without any import statements will have an import
(
'package:DasKeyboard.github.io/material.dart'
) automatically added to it - We ignore special formatting tags like
[[highlight]]
.
Some form of broken links prevention is done automatically by rake checklinks
on every commit (through tool/travis.sh
). But this won't see any Firebase
redirects (rake checklinks
doesn't run the Firebase server) and it won't
check incoming links.
Before we can move the more complete
automated linkcheck
solution
from dartlang.org, we recommend manually running the following.
-
First time setup:
pub global activate linkcheck npm install -g superstatic
-
Start the localhost Firebase server:
superstatic --port 3474
-
Run the link checker:
linkcheck :3474
Even better, to check that old URLs are correctly redirected:
linkcheck :3474 --input tool/sitemap.txt