Skip to content

Commit

Permalink
build mochajs.org with Jekyll; closes #1640
Browse files Browse the repository at this point in the history
Lots of stuff here, but the main things:

- use Jekyll
- convert `index.md` to *actual GFM Markdown*
- a lot of edits of the documentation, including, but not limited to:
  - reorganization
  - grammar fixes
  - code style fixes
  - rewording confusing sentences
  - add a couple more examples
  - dynamically generate TOC
  - use CDNs for JS, though there's basically none

I've taken every effort to make the site look as close to the current version as it does now, and keep it compatible with old browsers.  However, I was not able to reuse the syntax highlighting scheme, as highlighting is now done by Pygments.

![screenshot 1](http://content.screencast.com/users/chiller/folders/Jing/media/32a9e9d6-b927-465a-a027-39d8bbfe0407/00000153.png)

![screenshot 2](http://content.screencast.com/users/chiller/folders/Jing/media/890e0481-65a4-4729-bc69-37098c48940f/00000154.png)
  • Loading branch information
Christopher Hiller authored and boneskull committed Jun 5, 2015
1 parent 5e1fabd commit 6c50c49
Show file tree
Hide file tree
Showing 29 changed files with 1,158 additions and 6,183 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true

[*.md]
trim_trailing_whitespace = false
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
.DS_Store
_site
node_modules
*.sock
testing
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gem 'github-pages'
127 changes: 127 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
GEM
specs:
RedCloth (4.2.9)
activesupport (4.2.1)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
blankslate (2.1.2.4)
celluloid (0.16.0)
timers (~> 4.0.0)
classifier-reborn (2.0.3)
fast-stemmer (~> 1.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
colorator (0.1)
execjs (2.5.2)
fast-stemmer (1.0.2)
ffi (1.9.8)
gemoji (2.1.0)
github-pages (37)
RedCloth (= 4.2.9)
github-pages-health-check (~> 0.2)
jekyll (= 2.4.0)
jekyll-coffeescript (= 1.0.1)
jekyll-feed (= 0.3.0)
jekyll-mentions (= 0.2.1)
jekyll-redirect-from (= 0.8.0)
jekyll-sass-converter (= 1.2.0)
jekyll-sitemap (= 0.8.1)
jemoji (= 0.4.0)
kramdown (= 1.5.0)
liquid (= 2.6.2)
maruku (= 0.7.0)
mercenary (~> 0.3)
pygments.rb (= 0.6.1)
rdiscount (= 2.1.7)
redcarpet (= 3.1.2)
terminal-table (~> 1.4)
github-pages-health-check (0.2.2)
net-dns (~> 0.6)
public_suffix (~> 1.4)
hitimes (1.2.2)
html-pipeline (1.9.0)
activesupport (>= 2)
nokogiri (~> 1.4)
i18n (0.7.0)
jekyll (2.4.0)
classifier-reborn (~> 2.0)
colorator (~> 0.1)
jekyll-coffeescript (~> 1.0)
jekyll-gist (~> 1.0)
jekyll-paginate (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 2.6.1)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
safe_yaml (~> 1.0)
toml (~> 0.1.0)
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
jekyll-feed (0.3.0)
jekyll-gist (1.2.1)
jekyll-mentions (0.2.1)
html-pipeline (~> 1.9.0)
jekyll (~> 2.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.8.0)
jekyll (>= 2.0)
jekyll-sass-converter (1.2.0)
sass (~> 3.2)
jekyll-sitemap (0.8.1)
jekyll-watch (1.2.1)
listen (~> 2.7)
jemoji (0.4.0)
gemoji (~> 2.0)
html-pipeline (~> 1.9)
jekyll (~> 2.0)
json (1.8.2)
kramdown (1.5.0)
liquid (2.6.2)
listen (2.10.0)
celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
maruku (0.7.0)
mercenary (0.3.5)
mini_portile (0.6.2)
minitest (5.6.0)
net-dns (0.8.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.11)
public_suffix (1.5.1)
pygments.rb (0.6.1)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdiscount (2.1.7)
redcarpet (3.1.2)
safe_yaml (1.0.4)
sass (3.4.13)
terminal-table (1.4.5)
thread_safe (0.3.5)
timers (4.0.1)
hitimes
toml (0.1.2)
parslet (~> 1.5.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
yajl-ruby (1.2.1)

PLATFORMS
ruby

DEPENDENCIES
github-pages
10 changes: 0 additions & 10 deletions Makefile

This file was deleted.

54 changes: 18 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,27 @@
# mocha: How to Build the Site
# [mochajs.org](http://mochajs.org): How to Build the Site

So you wanna build the site?
*So you wanna build the site?*

## Requirements
mochajs.org is now built using [Jekyll](http://jekyllrb.com), the popular static site generator.

There's two:
## Prerequisites

1. [make](http://www.gnu.org/software/make/)
2. [markdown](http://daringfireball.net/projects/markdown/)
1. Some recent version of Ruby
2. A recent version of Node.JS
3. [Bundler](http://bundler.io)

### Mac OS X
To install Bundler, after installing Ruby, execute `gem install bundler`.

4. Now, execute `npm install`. This will install Jekyll and a bunch of other
crap we need.

5. To build, execute `npm run-script build`.

Install `markdown` via Homebrew:
For more information, refer to the [Jekyll Docs](http://jekyllrb.com/docs/home/) and [GitHub's Tutorial](https://help.github.com/articles/using-jekyll-with-pages/) on the subject.

```sh
brew install markdown
```
## Notes

Or download from [here](http://daringfireball.net/projects/markdown/).

Celebrate with tequila! Or try to build first. Probably want to build first.

### Linux

#### Ubuntu 14.04

1. `sudo apt-get install build-essential` to install make.
2. `sudo apt-get install markdown` to install markdown.
3. That seems to do it. It's just a Perl script, so you can [get it from here](http://daringfireball.net/projects/markdown/) otherwise.

### Windows

*To be filled in by somebody using Windows*

## Building

Execute:

```
make clean && make
```

You should now have an updated `index.html`. Open it in your browser and proceed to tweak it until it's correct, because the compiler seem a little wonky.
- The TOC is generated with [marked-toc](https://www.npmjs.com/package/marked-toc).
- The `id` attributes for all of the headers are generated with JavaScript.
- The `_site` directory is where the generated site lives. It is *not* under version control, because GitHub Pages generates it for us.

10 changes: 10 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
url: http://mochajs.org
markdown: redcarpet
highlighter: pygments
exclude:
- node_modules
- README.md
- Gemfile*
- package.json
- CNAME

28 changes: 28 additions & 0 deletions _includes/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<footer>
<span>&copy; 2011-2015 TJ Holowaychuk. All rights reserved. Licensed <a href="http://opensource.org/licenses/MIT" target="_blank">MIT</a></span>
<script>
setTimeout(function () {
// cause the header to animate
document.body.className = 'onload';
});

// associate h# tags with id's based on text content.
function setIds() {
var elements = Array.prototype.slice.call(document.getElementsByTagName('h1'))
.concat(Array.prototype.slice.call(document.getElementsByTagName('h2')))
.concat(Array.prototype.slice.call(document.getElementsByTagName('h3'))),
element, slug;

for (var i = 0; i < elements.length; i++) {
element = elements[i];
slug = element.textContent.toLowerCase()
.replace(/[^A-Za-z0-9]/g, '-')
.replace(/--/g, '-');
element.setAttribute('id', slug);
}
}

setIds();

</script>
</footer>
12 changes: 12 additions & 0 deletions _includes/head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<head>
<meta charset="utf-8">
<title>Mocha - the fun, simple, flexible JavaScript test framework</title>
<link rel="stylesheet" href="css/normalize.min.css"/>
<link rel="stylesheet" href="css/style.css"/>
<link rel="stylesheet" href="css/pygments.css"/>
<link rel="shortcut icon" href="favicon.ico"/>

<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.2/html5shiv.min.js"></script>
<![endif]-->
</head>
4 changes: 4 additions & 0 deletions _includes/header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<header>
<h1><a href="http://mochajs.org/">Mocha</a></h1>
<p id="tag"><em>simple</em>, <em>flexible</em>, <em>fun</em></p>
</header>
18 changes: 18 additions & 0 deletions _layouts/default.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">

{% include head.html %}

<body>

{% include header.html %}

<section id="content">
{{ content }}
</section>

{% include footer.html %}

</body>

</html>
Loading

0 comments on commit 6c50c49

Please sign in to comment.