Skip to content

Commit c70ba77

Browse files
author
Lucas Wojciechowski
committed
Merge remote-tracking branch 'origin/mb-pages'
2 parents 7621d35 + 8048b3c commit c70ba77

37 files changed

+2160
-274
lines changed

_config.mb-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
url: https://www.mapbox.com
22
api: https://www.mapbox.com/core
3-
tileApi: https://api.tiles.mapbox.com
3+
tileApi: https://api.mapbox.com
44
source: docs
55
permalink: /:categories/:title
6-
baseurl: /mapbox-gl-js
6+
baseurl: https://www.mapbox.com/mapbox-gl-js
77
highlighter: pygments
88
excerpt_separator: ""
99
version: v0.18.0

docs/README.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
Mapbox GL JS has [API documentation](#api-documentation) and [examples](#examples).
22

3-
## API Documentation
3+
## Writing API Documentation
44

5-
API documentation is written as [JSDoc comments](http://usejsdoc.org/) and processed with [documentationjs](http://documentation.js.org/). We aim to document all classes and methods, public and private. Mark private classes and methods with `@private`.
5+
API documentation is written as [JSDoc comments](http://usejsdoc.org/) and processed with [documentationjs](http://documentation.js.org/).
66

7-
Any interface not explicitly marked as `@private` will be displayed on the official [Mapbox GL JS documentation page](https://www.mapbox.com/mapbox-gl-js/api/). Internal interfaces can and should be documented with JSDoc comments but must be marked as `@private`.
7+
- Classes, methods, events and anything else in the public interface must be documented with a JSDoc comment. Everything outside of the public interface may be documented and must be tagged as `@private`.
8+
- Text within JSDoc comments may use markdown formatting. Code identifiers must be surrounded by \`backticks\`.
9+
- Documentation must be written in complete gramatically-correct sentances.
10+
- Documentation must specify measurement units when applicable.
11+
- Documentation descriptions must contain more information than what is obvious from the identifier and JSDoc metadata.
12+
- `@param` and `@property` descriptions should be capitalized and written as if completing a sentance beginning with "This is..." or "This...".
813

9-
References:
10-
11-
* [Documentation.js Homepage](http://documentation.js.org)
12-
* [Documentation.js Getting Started Guide](https://github.com/documentationjs/documentation/blob/master/docs/GETTTING_STARTED.md)
13-
* [JSDoc Specification](http://usejsdoc.org/index.html)
14-
15-
## Examples
14+
## Writing Examples
1615

1716
Examples are written as Jekyll posts in `docs/_posts/examples`. The Jekyll front matter should include the following items:
1817

@@ -28,7 +27,7 @@ In the post body, write the HTML and JavaScript constituting the example.
2827
* Do **not** use custom styles from your personal account. Use only the default `mapbox` account styles.
2928
* When embedding literal JSON (GeoJSON or GL style snippets) into script code, double-quote property names and string values. Elsewhere, use single-quoted strings.
3029

31-
## Running Documentation Server Locally
30+
## Running the Documentation Server Locally
3231

3332
To start a documentation server locally run
3433
```bash
@@ -41,7 +40,7 @@ You can view the documentation at
4140
open http://127.0.0.1:4000/mapbox-gl-js
4241
```
4342

44-
## Troubleshooting
43+
### Troubleshooting
4544

4645
Ensure you have the right version of all dependencies
4746

@@ -56,7 +55,7 @@ jekyll -v
5655
> jekyll 2.5.3
5756
```
5857

59-
## Branch Usage
58+
## Committing and Publishing Documentation
6059

6160
The mapbox-gl-js repository has both `master` and `mb-pages` as active branches. The **`master` branch** is used for mainline code development: the next version of mapbox-gl-js will come from the code in this branch, and it may contain documentation and examples for APIs that are not yet part of a public release. The **`mb-pages` branch** is published to https://www.mapbox.com/mapbox-gl-js/ on any push to the branch. For the purposes of documentation changes, use these two branches as follows:
6261

docs/_layouts/default.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
path: /contact
4242
- title: Education
4343
path: /education
44+
- title: Humanitarian
45+
path: /humanitarian
4446
- title: Security
4547
path: /security
4648
mapdesign:
@@ -105,8 +107,8 @@
105107
{% if page.card %}
106108
<meta name='twitter:site' content='@Mapbox' />
107109
<meta property='og:site_name' content='Mapbox' />
108-
<meta name='twitter:url' content='{% if page.permalink %}{{page.permalink}}{% else %}{{page.url | replace:"index.html",""}}{% endif %}' />
109-
<meta property='og:url' content='{% if page.permalink %}{{page.permalink}}{% else %}{{page.url | replace:"index.html",""}}{% endif %}' />
110+
<meta name='twitter:url' content='{{site.url}}{{site.baseurl}}{% if page.permalink %}{{page.permalink}}{% else %}{{page.url | replace:"index.html",""}}{% endif %}' />
111+
<meta property='og:url' content='{{site.url}}{{site.baseurl}}{% if page.permalink %}{{page.permalink}}{% else %}{{page.url | replace:"index.html",""}}{% endif %}' />
110112
<meta name='twitter:title' content='{{page.title | replace:"'","&rsquo;" | replace:"'","&rsquo;"}}' />
111113
<meta property='og:title' content='{{page.title | replace:"'","&rsquo;" | replace:"'","&rsquo;"}}' />
112114
<meta name='twitter:description' content='{% if page.description %}{{ page.description | truncatewords: 30 }}{% elsif page.excerpt %}{{ page.excerpt | strip_html | strip_newlines | replace:"'","&rsquo;" | replace:"'","&rsquo;" | truncatewords: 30 }}{% else %}{{content | strip_html | truncatewords: 30 }}{% endif %}' />
@@ -258,7 +260,7 @@ <h3><a href='/developers/' class='rcon next'>Developer tools</a></h3>
258260
<a class='block pad1y icon compass' href='/api-documentation/#directions'>Directions API</a>
259261
<a class='block pad1y icon point-line' href='/api-documentation/#distance'>Distance API</a>
260262
<a class='block pad1y icon picture' href='/api-documentation/#static'>Static API</a>
261-
<a class='block pad1y icon data' href='/api-documentation/#maps'>Tiles API</a>
263+
<a class='block pad1y icon data' href='/api-documentation/#maps'>Maps API</a>
262264
</div>
263265
</div>
264266
<div class='col3 margin1r subnavcol'>

docs/_layouts/docs.html

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
---
66

77

8-
<div class='round doc clip fill-white keyline-all'>
8+
<div class='round doc clip fill-white keyline-all space-bottom'>
99

1010
<section class='pad4 keyline-bottom contain'>
1111

@@ -18,39 +18,51 @@ <h1 class='space-bottom2'>
1818
</h1>
1919

2020
<div class='prose space-bottom2'>
21-
<p>Mapbox GL JS is a JavaScript library that uses WebGL to render interactive maps from <a href='https://www.mapbox.com/blog/vector-tiles'>vector tiles</a> and <a href='https://www.mapbox.com/mapbox-gl-style-spec'>Mapbox GL styles</a><p>
22-
<p>It is part of the <a href='https://github.com/mapbox/mapbox-gl'>Mapbox GL ecosystem</a> which includes <a href='https://www.mapbox.com/mobile/'>Mapbox Mobile</a>, a suite of compatible SDKs for native desktop and mobile applications.</p>
23-
<a href='https://www.mapbox.com/gallery/'><img width='981' alt='Mapbox GL JS gallery' src='{{site.baseurl}}/assets/gallery.png'></a>
21+
<p>Mapbox GL JS is a JavaScript library that uses WebGL to render interactive maps from <a href='{{site.url}}/help/define-vector-tiles'>vector tiles</a> and <a href='{{site.url}}/mapbox-gl-style-spec'>Mapbox GL styles</a>.<p>
22+
<p>It is part of the <a href='https://github.com/mapbox/mapbox-gl'>Mapbox GL ecosystem</a> which includes <a href='{{site.url}}/mobile/'>Mapbox Mobile</a>, a compatible renderer written in C++ with bindings for desktop and mobile platforms.</p>
2423
</div>
24+
<a href='https://www.mapbox.com/gallery/'><img alt='Mapbox GL JS gallery' src='{{site.baseurl}}/assets/gallery.png'></a>
25+
</section>
26+
</div>
2527

26-
<h2 class='space'>Using Mapbox GL JS with a <code>&lt;script&gt;</code> tag</h2>
28+
<div class='keyline-all fill-darken0 space-bottom round'>
29+
<div class='pad1y pad2x keyline-bottom strong small clearfix'>
30+
<span class='fill-darken1 pad1x round dark inline fr'>mapbox-gl.js {{site.version}}</span>
31+
Get started
32+
</div>
33+
<div class='pad2'>
34+
<div class='fill-white js-replace-token' id='head-code'>{% highlight html %}
35+
<script src='{{site.tileApi}}/mapbox-gl-js/{{site.version}}/mapbox-gl.js'></script>
36+
<link href='{{site.tileApi}}/mapbox-gl-js/{{site.version}}/mapbox-gl.css' rel='stylesheet' />{% endhighlight html %}
37+
</div>
38+
<a class='button icon clipboard col12 round-bottom js-clipboard space-bottom1' href='#' data-clipboard-target='head-code'>Copy code</a>
2739

28-
<div class='prose space-bottom2'>
29-
<p>To use the <a href='https://www.mapbox.com/maps/'>vector tiles</a> and styles hosted on <a href='http://mapbox.com'>Mapbox</a>, you must <a href='https://www.mapbox.com/studio/signup/'>create an account</a> and <a href='https://www.mapbox.com/studio/account/tokens/'>obtain an access token</a>. You can learn more about access tokens <a href='https://www.mapbox.com/help/define-access-token/'>here</a>.
30-
31-
<pre>
32-
&lt;!DOCTYPE html&gt;
33-
&lt;html&gt;
34-
&lt;head&gt;
35-
&lt;script src='https://api.tiles.mapbox.com/mapbox-gl-js/{{site.version}}/mapbox-gl.js'&gt;&lt;/script&gt;
36-
&lt;link href='https://api.tiles.mapbox.com/mapbox-gl-js/{{site.version}}/mapbox-gl.css' rel='stylesheet'&gt;
37-
&lt;/head&gt;
38-
39-
&lt;body&gt;
40-
&lt;div id='map' style='width: 400px; height: 300px;' /&gt;
41-
42-
&lt;script&gt;
43-
mapboxgl.accessToken = '&lt;your access token here&gt;';
44-
var map = new mapboxgl.Map({
45-
container: 'map',
46-
style: 'mapbox://styles/mapbox/streets-v8'
47-
});
48-
&lt;/script&gt;
49-
&lt;/body&gt;
50-
&lt;/html&gt;
51-
</pre>
40+
<div class='pad1x small quiet space-bottom1'>
41+
Include the JavaScript and CSS files in the <code>&lt;head&gt;</code> of your HTML file.
5242
</div>
53-
</section>
5443

44+
<div class='fill-white js-replace-token' id='body-code'>
45+
{% capture getting_started_html %}
46+
<div id='map' style='width: 400px; height: 300px;'></div>
47+
<script>
48+
var map = new mapboxgl.Map({
49+
container: 'map',
50+
style: 'mapbox://styles/mapbox/streets-v8'
51+
});
52+
</script>
53+
{% endcapture %}
54+
55+
{% highlight html %}{{ getting_started_html | insert_token }}{% endhighlight %}
56+
</div>
57+
<a class='button icon clipboard col12 round-bottom js-clipboard space-bottom1' href='#' data-clipboard-target='body-code'>Copy code</a>
58+
59+
<div class='pad1x small quiet'>
60+
Include this code in the <code>&lt;body&gt;</code> of your HTML file to initialize a map on the page.
61+
<a class='truncate rcon next' href='{{site.baseurl}}/examples/'>View basic example</a>
62+
</div>
63+
</div>
64+
</div>
65+
66+
<div class='round doc clip fill-white keyline-all space-top'>
5567
{{ content }}
5668
</div>

docs/_posts/examples/3400-01-04-color-switcher.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
});
8686

8787
var swatches = document.getElementById('swatches');
88-
var layers = document.getElementById('layers');
88+
var layer = document.getElementById('layer');
8989
var colors = [
9090
'#ffffcc',
9191
'#a1dab4',

docs/_posts/examples/3400-01-05-queryrenderedfeatures.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
overflow: auto;
1515
background: rgba(255, 255, 255, 0.8);
1616
}
17+
#map canvas {
18+
cursor: crosshair;
19+
}
1720
</style>
1821
<div id='map'></div>
1922
<pre id='features'></pre>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: example
3+
category: example
4+
title: Data-driven circle coloring by ethnicity
5+
description: Using a categorical circle-color property for a visualization
6+
---
7+
<div id='map'></div>
8+
<script>
9+
var map = new mapboxgl.Map({
10+
container: 'map',
11+
style: 'mapbox://styles/mapbox/light-v8',
12+
zoom: 12,
13+
center: [-122.447303, 37.753574]
14+
});
15+
16+
map.on('load', function () {
17+
map.addSource('population', {
18+
type: 'vector',
19+
url: 'mapbox://examples.8fgz4egr'
20+
});
21+
map.addLayer({
22+
'id': 'population',
23+
'type': 'circle',
24+
'source': 'population',
25+
'source-layer': 'sf2010',
26+
'paint': {
27+
// make circles larger as the user zooms from z12 to z22
28+
'circle-radius': {
29+
'base': 1.75,
30+
'stops': [[12, 2], [22, 180]]
31+
},
32+
// color circles by ethnicity, using data-driven styles
33+
'circle-color': {
34+
property: 'ethnicity',
35+
type: 'categorical',
36+
stops: [
37+
['White', '#fbb03b'],
38+
['Black', '#223b53'],
39+
['Hispanic', '#e55e5e'],
40+
['Asian', '#3bb2d0'],
41+
['Other', '#ccc']]
42+
}
43+
}
44+
});
45+
});
46+
</script>

docs/_posts/examples/3400-01-12-mapbox-gl-geocoder.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- plugins
88
- mapbox-geocoding
99
---
10-
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.0.0/mapbox-gl-geocoder.js'></script>
11-
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.0.0/mapbox-gl-geocoder.css' type='text/css' />
10+
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.1.0/mapbox-gl-geocoder.js'></script>
11+
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.1.0/mapbox-gl-geocoder.css' type='text/css' />
1212
<div id='map'></div>
1313

1414
<script>

docs/_posts/examples/3400-01-16-point-from-geocoder-result.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
- plugins
88
- mapbox-geocoding
99
---
10-
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.0.0/mapbox-gl-geocoder.js'></script>
11-
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.0.0/mapbox-gl-geocoder.css' type='text/css' />
10+
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.1.0/mapbox-gl-geocoder.js'></script>
11+
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.1.0/mapbox-gl-geocoder.css' type='text/css' />
1212
<style>
1313
#geocoder-container {
1414
position: absolute;

docs/_posts/plugins/0100-01-01-mapbox-gl-geocoder.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99
code: https://github.com/mapbox/mapbox-gl-geocoder
1010
license: BSD
1111
---
12-
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.0.0/mapbox-gl-geocoder.js'></script>
13-
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.0.0/mapbox-gl-geocoder.css' type='text/css' />
12+
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.1.0/mapbox-gl-geocoder.js'></script>
13+
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v1.1.0/mapbox-gl-geocoder.css' type='text/css' />

0 commit comments

Comments
 (0)