Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a668888
Upgrade to Webpack 4
gj Sep 17, 2018
21536b4
Downgrade highlight.js dependency to 9.11.x
gj Sep 17, 2018
b0bbda1
Clean up old builds before building new builds
gj Sep 17, 2018
646e913
Upgrade to Babel 7
gj Sep 17, 2018
be8c81e
Add in UglifyJS for parity with Gulpfile
gj Sep 17, 2018
1eb09af
Update output filenames for parity with existing Gulp pipeline
gj Sep 17, 2018
9958854
Update Gulpfile per current progress of revamp
gj Sep 17, 2018
c3a750e
Have Webpack handle styles and fonts
gj Sep 17, 2018
71470f2
Transition watch mode from Gulp to Webpack
gj Sep 17, 2018
67a98cf
Update Gulpfile per current progress of revamp
gj Sep 17, 2018
311d912
Look for new html* files instead of old app* files
gj Sep 17, 2018
ed8e1be
Allow creation of nested directories
gj Sep 17, 2018
9f03ed4
Register Handlebars helpers
gj Sep 17, 2018
19320ae
Commit the built assets and remove old ones
gj Sep 17, 2018
c558b7a
Upgrade ESLint and remove Gulp task
gj Sep 17, 2018
574c582
Only autoclean before production Webpack builds
gj Sep 17, 2018
5d7df05
Remove no-longer-needed helper from Gulp pipeline
gj Sep 17, 2018
e638e3b
Upgrade Karma Webpack
gj Sep 17, 2018
8eec608
Update the test script and fully remove Gulp
gj Sep 17, 2018
9af2275
Update outdated packages with security vulnerabilities
gj Sep 17, 2018
a020c87
Minor housekeeping updates to package.json
gj Sep 17, 2018
43af32e
Lock development to >= NPM v5.6.0 and >= Node 10.0.0
gj Sep 17, 2018
422fccd
Update asset docs
gj Sep 17, 2018
4430fcf
Look for new epub* JS file instead of old app* file
gj Sep 17, 2018
1d1e116
Update failing tests
gj Sep 17, 2018
8d774d2
Update TravisCI config to run on Node 10
gj Sep 17, 2018
01258be
Restrict ESLint scope to assets/js/ directory
gj Sep 17, 2018
89959d4
Move asset configuration files into assets/ dir
gj Sep 21, 2018
26eb5e1
Bring epub.js closer to parity with app.js
gj Sep 21, 2018
decc9e7
We probably want Elixir highlighting
gj Sep 21, 2018
22df224
Get some syntax highlighting for the shell snippets
gj Sep 21, 2018
10efa7f
Fix the cleanup path after moving asset config into the assets/ dir
gj Sep 21, 2018
b5293a5
Actually we don't want Elixir syntax highlighting
gj Sep 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
/erl_crash.dump
/node_modules
/npm-debug.log

# Ignore artifacts from non-production builds
formatters/epub/dist/epub.js
formatters/html/dist/html.js
10 changes: 7 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ otp_release: 20.3
notifications:
recipients:
- jose.valim@plataformatec.com.br
env:
global:
- MIX_ENV=test
- DISPLAY=:99.0
- NODE_VERSION="10.10.0"
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- mix local.hex --force
- mix deps.get
env:
- MIX_ENV=test
before_install:
- nvm install $NODE_VERSION
script:
- mix format --check-formatted
- mix test
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,26 @@ You can ExDoc via the command line as follows:

1. Install ExDoc as an escript:

```console
```bash
$ mix escript.install hex ex_doc
```

2. Then you are ready to use it in your projects. First, move into your project directory and make sure it is already compiled:

```console
```bash
$ cd PATH_TO_YOUR_PROJECT
$ mix compile
```

3. Next invoke the ex_doc executable from your project:

```console
```bash
$ ex_doc "PROJECT_NAME" "PROJECT_VERSION" path/to/project/ebin -m "PROJECT_MODULE" -u "https://github.com/GITHUB_USER/GITHUB_REPO" -l path/to/logo.png
```

4. By default, ex_doc produces HTML files, but, you can also create a EPUB document passing the option `--formatter epub`:

```console
```bash
$ PATH_TO_YOUR_EXDOC/bin/ex_doc "PROJECT_NAME" "PROJECT_VERSION" path/to/project/ebin -m "PROJECT_MODULE" -u "https://github.com/GITHUB_USER/GITHUB_REPO" -l path/to/logo.png -f epub
```

Expand Down
7 changes: 7 additions & 0 deletions assets/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ignore build artifacts
formatters/*
doc/*
test/*

# Ignore JavaScript files in dependencies
deps/*
3 changes: 2 additions & 1 deletion .eslintrc → assets/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"rules": {
"no-path-concat": 0,
"no-useless-escape": 0
"no-useless-escape": 0,
"object-curly-spacing": 0
}
}
38 changes: 15 additions & 23 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,41 @@
# Assets

In this directory live all assets for `ExDoc`. The ready to use built
In this directory live all assets for `ExDoc`. The built, ready-to-use
versions are found in `formatters/{html,epub}/dist`.

To work on these assets you need to install [Node.js] (version 10) and
[npm] (version 5.6) first (maybe as superuser or administrator).
[NPM] (version 5.6) first (maybe as superuser or administrator).

## npm run scripts
## `npm run` scripts

The following scripts are available

### `build`

This will build a complete production bundle, including JavaScript and CSS.
If you run `mix build` at `ExDoc` root after changing your assets, it will
automatically recompile the assets, invoke `mix compile --force` and generate
If you run `mix build` at the `ExDoc` root after changing your assets, it will
automatically recompile the assets, invoke `mix compile --force`, and generate
fresh docs with your changes.

### `clean`

Clean all content in the build folder `dist` for each format.

### `lint`

Lint all JavaScript files in `js` using [ESLint].
Lint all JavaScript files using [ESLint].

### `test`

Run all the available tests for JavaScript using [Karma].
Run all the available JavaScript tests using [Karma].

### `watch`

Builds JavaScript and CSS on file changes in `assets/less/**/*.less` or
`assets/js/**/*.js` for each format.
Builds JavaScript and CSS on file changes for each format.

## Gulp
## Webpack

Internally we use [gulp]. The project is organized in tasks
(`watch`, `build`, etc) and subtasks based on HTML and EPUB
formats. We also use [webpack] and [less].
Internally we use [Webpack]. We also use [Less] for organizing stylesheets.

[Node.js]: https://nodejs.org/
[npm]: https://www.npmjs.com/
[gulp]: https://www.npmjs.com/package/gulp
[webpack]: http://webpack.github.io/
[less]: http://lesscss.org/
[ESLint]: http://eslint.org/
[Karma]: http://karma-runner.github.io/
[NPM]: https://www.npmjs.com/
[ESLint]: https://eslint.org/
[Karma]: https://karma-runner.github.io/
[Webpack]: https://webpack.js.org/
[Less]: http://lesscss.org/
7 changes: 7 additions & 0 deletions assets/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const presets = [
['@babel/env', {
useBuiltIns: 'usage'
}]
]

module.exports = { presets }
Binary file added assets/fonts/icomoon.eot
Binary file not shown.
18 changes: 18 additions & 0 deletions assets/fonts/icomoon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/fonts/icomoon.ttf
Binary file not shown.
Binary file added assets/fonts/icomoon.woff
Binary file not shown.
43 changes: 40 additions & 3 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,26 @@
// ------------

import $ from 'jquery'
import hljs from 'highlight.js/build/highlight.pack'
import Handlebars from 'handlebars/runtime'

import hljs from 'highlight.js/lib/highlight'
import bash from 'highlight.js/lib/languages/bash'
import css from 'highlight.js/lib/languages/css'
import diff from 'highlight.js/lib/languages/diff'
import erlang from 'highlight.js/lib/languages/erlang'
import erlangRepl from 'highlight.js/lib/languages/erlang-repl'
import http from 'highlight.js/lib/languages/http'
import javascript from 'highlight.js/lib/languages/javascript'
import json from 'highlight.js/lib/languages/json'
import markdown from 'highlight.js/lib/languages/markdown'
import sql from 'highlight.js/lib/languages/sql'
import xml from 'highlight.js/lib/languages/xml'

import isArray from './template-helpers/isArray'
import isEmptyNode from './template-helpers/isEmptyNode'
import isLocal from './template-helpers/isLocal'
import newGroup from './template-helpers/newGroup'
import showSummary from './template-helpers/showSummary'

import {initialize as initEvents} from './events'
import {initialize as initSidebar} from './sidebar'
Expand All @@ -12,11 +31,29 @@ import {initialize as initMakeup} from './makeup'
window.$ = $

$(() => {
// Setup Highlight.js
// Set up Handlebars.js
Handlebars.registerHelper('isArray', isArray)
Handlebars.registerHelper('isEmptyNode', isEmptyNode)
Handlebars.registerHelper('isLocal', isLocal)
Handlebars.registerHelper('newGroup', newGroup)
Handlebars.registerHelper('showSummary', showSummary)

// Set up Highlight.js
hljs.configure({
tabReplace: ' ', // 4 spaces
languages: [] // disable auto-detect
languages: [] // disable auto-detect
})
hljs.registerLanguage('bash', bash)
hljs.registerLanguage('css', css)
hljs.registerLanguage('diff', diff)
hljs.registerLanguage('erlang', erlang)
hljs.registerLanguage('erlang-repl', erlangRepl)
hljs.registerLanguage('http', http)
hljs.registerLanguage('javascript', javascript)
hljs.registerLanguage('json', json)
hljs.registerLanguage('markdown', markdown)
hljs.registerLanguage('sql', sql)
hljs.registerLanguage('xml', xml)

initNightMode()
initSidebar()
Expand Down
31 changes: 30 additions & 1 deletion assets/js/epub.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
// Dependencies
// ------------

import hljs from 'highlight.js/build/highlight.pack'
import hljs from 'highlight.js/lib/highlight'
import bash from 'highlight.js/lib/languages/bash'
import css from 'highlight.js/lib/languages/css'
import diff from 'highlight.js/lib/languages/diff'
import erlang from 'highlight.js/lib/languages/erlang'
import erlangRepl from 'highlight.js/lib/languages/erlang-repl'
import http from 'highlight.js/lib/languages/http'
import javascript from 'highlight.js/lib/languages/javascript'
import json from 'highlight.js/lib/languages/json'
import markdown from 'highlight.js/lib/languages/markdown'
import sql from 'highlight.js/lib/languages/sql'
import xml from 'highlight.js/lib/languages/xml'

import {initialize as initMakeup} from './makeup'

// Set up Highlight.js
hljs.configure({
tabReplace: ' ', // 4 spaces
languages: [] // disable auto-detect
})
hljs.registerLanguage('bash', bash)
hljs.registerLanguage('css', css)
hljs.registerLanguage('diff', diff)
hljs.registerLanguage('erlang', erlang)
hljs.registerLanguage('erlang-repl', erlangRepl)
hljs.registerLanguage('http', http)
hljs.registerLanguage('javascript', javascript)
hljs.registerLanguage('json', json)
hljs.registerLanguage('markdown', markdown)
hljs.registerLanguage('sql', sql)
hljs.registerLanguage('xml', xml)

initMakeup()
hljs.initHighlightingOnLoad()
2 changes: 1 addition & 1 deletion assets/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ------------

import $ from 'jquery'
import {throttle} from 'lodash'
import throttle from 'lodash.throttle'

// Constants
// ---------
Expand Down
2 changes: 1 addition & 1 deletion assets/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var webpackConfig = require('./webpack.config').development
const webpackConfig = require('./webpack/development.js')

module.exports = function (config) {
config.set({
Expand Down
6 changes: 3 additions & 3 deletions assets/less/app.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@import (inline) './fonts.css';

@import 'npm://highlight.js/src/styles/tomorrow';
@import 'npm://normalize.css/normalize';
@import 'npm://flex.less/flex';
@import (css) '~highlight.js/styles/tomorrow.css';
@import (css) '~normalize.css/normalize.css';
@import '~flex.less/flex.less';

@import './mixins';
@import './variables';
Expand Down
2 changes: 2 additions & 0 deletions assets/less/content/code.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../variables';

a.no-underline,
pre a {
color: @purple;
Expand Down
4 changes: 3 additions & 1 deletion assets/less/content/footer.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.footer {
@import '../variables';

margin: 4em auto 1em;
text-align: center;
font-style: italic;
Expand All @@ -13,4 +15,4 @@
color: @mediumGray;
.linkUnderlines(@mediumGray)
}
}
}
4 changes: 3 additions & 1 deletion assets/less/content/functions.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../variables';

@keyframes blink-background {
from {
background-color: @detailGray;
Expand Down Expand Up @@ -102,4 +104,4 @@ div.deprecated {
display: block;
padding: 9px 15px;
background-color: @deprecated;
}
}
1 change: 1 addition & 0 deletions assets/less/content/general.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import '../variables';

h1,
h2,
Expand Down
2 changes: 2 additions & 0 deletions assets/less/content/summary.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.summary {
@import '../variables';

h2 {
font-weight: 700;

Expand Down
3 changes: 1 addition & 2 deletions assets/less/epub.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

@import 'npm://highlight.js/src/styles/tomorrow';
@import (css) '~highlight.js/styles/tomorrow.css';

@import './variables';
@import './makeup';
Expand Down
2 changes: 2 additions & 0 deletions assets/less/night/content.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
body.night-mode .content-inner {
@import '../variables';

color: @nightTextBody;

@import './content/general';
Expand Down
2 changes: 2 additions & 0 deletions assets/less/night/content/code.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../variables';

code {
background-color: @nightCodeBackground;
border-color: lighten(@nightCodeBackground, 10%);
Expand Down
4 changes: 3 additions & 1 deletion assets/less/night/content/footer.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.footer {
@import '../../variables';

color: @mediumGray;

.line {
Expand All @@ -8,4 +10,4 @@
a {
color: @mediumGray;
}
}
}
2 changes: 2 additions & 0 deletions assets/less/night/content/functions.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../variables';

@keyframes night-blink-background {
from {
background-color: @nightHeader;
Expand Down
2 changes: 2 additions & 0 deletions assets/less/night/content/general.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../variables';

h1,
h2,
h3,
Expand Down
3 changes: 2 additions & 1 deletion assets/less/night/night.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
}

body.night-mode {
@import 'npm://highlight.js/src/styles/tomorrow-night';
@import '../variables';
@import (css) '~highlight.js/styles/tomorrow-night.css';
background: @nightBackground;

.content-outer {
Expand Down
Loading