Skip to content

Commit 6341ac1

Browse files
committed
docs: Update build docs and clarify instructions
1 parent e4f346b commit 6341ac1

8 files changed

Lines changed: 131 additions & 387 deletions

File tree

README.md

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ The easiest way to do this is to follow the `Edit this page on GitHub` link at t
3434

3535
![Screen Shot 2020-01-07 at 12 45 39 PM](https://user-images.githubusercontent.com/1557650/71916356-bfe53800-314b-11ea-92b6-eb763037f6d5.png)
3636

37-
**Note:** You don't have to worry about breaking the site when you submit a pull request!** This is because your change will not be merged to production immediately. A Plotly team member will first perform a code review on your pull request.
37+
**Note:** You don't have to worry about breaking the site when you submit a pull request! This is because your change will not be merged to production immediately. A Plotly team member will first perform a code review on your pull request.
3838

3939
## How To Get The Application Working Locally
4040

41-
For more extensive changes to Ploty's JavaScript documentation, we suggest getting the Jekyll application which builds the site to run locally so that you can test your changes as you develop them.
41+
For more extensive changes to Plotly's JavaScript documentation, we suggest getting the Jekyll application which builds the site to run locally so that you can test your changes as you develop them.
4242

43-
This involves cloning the repository and installing its dependencies: [Git](https://git-scm.com/), [Ruby]((https://www.ruby-lang.org/en/), [Jekyll](https://jekyllrb.com/), and the [Python `requests` package](https://pypi.org/project/requests/).
43+
This involves cloning the repository and installing its dependencies: [Git](https://git-scm.com/), [Ruby](https://www.ruby-lang.org/en/), and the Python packages used by the CI scripts.
4444

4545
1. Use [`git`](https://git-scm.com/) to [clone](https://git-scm.com/docs/git-clone) the public `plotly/graphing-library-docs` repository.
4646

@@ -60,42 +60,41 @@ Your branch is up to date with 'origin/master'.
6060
nothing to commit, working tree clean
6161
```
6262

63-
2. Download Ruby and check your `Ruby` version by running the `ruby --version` command in your terminal.
63+
2. Install Ruby 2.7.4. Check your version with `ruby --version`. [RVM](https://rvm.io/rvm/install) is helpful for installing and managing Ruby versions.
6464

65-
**Note:** We recommend using `version 2.7.4`, the same ruby version as [gh-pages](https://pages.github.com/versions/). Note [RVM](https://rvm.io/rvm/install) is helpful for installing and managing ruby versions.
65+
3. Install all remaining dependencies (Ruby gems, Python packages, Node packages, and upstream tutorial content) in one step:
6666

67-
3. Download Jekyll and check your Jekyll version by running the `jekyll -v` command in your terminal. We recommend using the same ruby version as [gh-pages](https://pages.github.com/versions/).
67+
```sh
68+
make setup
69+
```
6870

69-
4. Install bundler and dependencies from the Jekyll applicaton's [`Gemfile`](https://github.com/plotly/graphing-library-docs/blob/master/Gemfile) by running the following commands in your terminal:
71+
If you'd rather install each piece manually, run these instead:
7072

7173
```sh
72-
gem install bundler
73-
bundle install
74+
gem install bundler && bundle install # Ruby gems (installs Jekyll)
75+
pip install -r requirements.txt # Python packages
76+
npm install # Node packages (for the gulp/scss workflow)
77+
make fetch_upstream_files # Python, R, Julia, Matlab, C#, and F# tutorial content
7478
```
7579

76-
**Note:** These dependencies should be the same version that [gh-pages](https://pages.github.com/versions/) is using.
80+
4. Serve the Jekyll application: `bundle exec jekyll serve --config _config_dev.yml`.
7781

78-
5. Serve the Jekyll application: `bundle exec jekyll serve --config _config_dev.yml`.
82+
5. Visit the pages at: [http://localhost:4000/](http://localhost:4000)
7983

80-
6. Visit the pages at: [http://localhost:4000/](http://localhost:4000)
81-
82-
**Note** The default Jekyll configuration file only builds the JavaScript posts by [excluding folders](https://jekyllrb.com/docs/configuration/options/). If you want to override this behavior, serve the application with a custom Jekyll configuration file in the root of the repository. Do this by copying `_config_dev.yml`, renaming it `_config_personal.yml`, and modifying the `exclude` statement.
84+
**Note** The default development configuration (`_config_dev.yml`) excludes `_posts/plotly_js` and `_posts/python-v3` for faster builds. If you want to include or exclude different folders, copy `_config_dev.yml`, rename it `_config_personal.yml`, and modify the `exclude` statement.
8385

8486
- If you name the Jekyll configuration file `_config_personal.yml`, it will be caught by the `.gitignore` file and not committed to version control.
8587
- Run `bundle exec jekyll serve --config _config_personal.yml` to use the custom configuration file
8688

87-
- Example configuration:
89+
- Example configuration that loads **only** the JavaScript posts:
8890
```yml
8991
# ---
9092
# Excludes every directory except JavaScript
9193
# ---
92-
exclude: ['_posts/reference_pages', _posts/ggplot2','_posts/julia','_posts/matlab','_posts/node_js','_posts/r','_posts/python','_posts/python-v3','_posts/misc','_posts/dashboards',_posts/scala', '_posts/nodejs', 'node_modules']
94+
exclude: ['_posts/reference_pages', '_posts/ggplot2', '_posts/julia', '_posts/matlab', '_posts/node_js', '_posts/r', '_posts/python', '_posts/python-v3', '_posts/misc', '_posts/dashboards', '_posts/scala', '_posts/nodejs', 'node_modules']
9395
```
9496
95-
and you'll only load the files in `_posts/plotly_js` directory because that is the only directory that is not excluded.
96-
97-
Change it to this:
98-
97+
- Example configuration that loads **every** directory:
9998
```yml
10099
# ---
101100
# Excludes no directory
@@ -104,21 +103,42 @@ staticurl: http://localhost:4000/all_static
104103
exclude: []
105104
```
106105
107-
and you'll load every file because no directories are excluded.
106+
**Note** The Python, R, Julia, Matlab, C#, and F# tutorial content is not stored in this repository — it is cloned in at build time from upstream repos by `make fetch_upstream_files`. If you want those pages to render locally, run `make fetch_upstream_files` before serving.
108107

109108
## Continuous Integration
110109

111-
Whenever a pull request is made, a continuous integration workflow is initiated. This includes of:
112-
- running the `check-or-enforce-order.py` and `front-matter-ci.py` scripts inside of a Docker container to validate YAML front-matter
113-
- Percy screenshot testing
110+
Whenever a pull request is made, the GitHub Actions workflow defined in [`.github/workflows/build.yml`](https://github.com/plotly/graphing-library-docs/blob/master/.github/workflows/build.yml) runs. It:
111+
- runs `front-matter-ci.py` to validate YAML front-matter
112+
- runs `check-or-enforce-order.py` against each tutorial directory to validate the `order` field
113+
- builds the site with `bundle exec jekyll build`
114+
- captures Percy snapshots for visual regression review
115+
116+
Making sure that a pull request passes every CI check is part of the code review process.
117+
118+
## Search indices
114119

115-
Making sure that a pull request passes every continuous integration test is a part of the code review process.
120+
Search on plotly.com docs pages is powered by Algolia indices that are updated separately from the site build. There are four indices, each updated by its own `make` target:
116121

117-
**For more information about the build process, inspect the CircleCI configuration file in this repository at https://github.com/plotly/graphing-library-docs/blob/master/.circleci/config.yml.**
122+
| Index | Search on | Update with |
123+
| --- | --- | --- |
124+
| `js_docs` | https://plotly.com/javascript/ | `make update_js_search` |
125+
| `python_docs` | https://plotly.com/python/, https://plotly.com/pandas/ | `make update_python_search` |
126+
| `r_docs` | https://plotly.com/r/, https://plotly.com/ggplot2/ | `make update_r_search` |
127+
| `schema` | reference pages (e.g. https://plotly.com/python/reference) | `make update_ref_search` |
128+
129+
You can browse the indices at https://www.algolia.com/apps/7EK9KHJW8M/explorer/browse/.
130+
131+
**When to update:** Run the appropriate `update_*_search` target whenever a new tutorial is added to the corresponding `_posts/` directory. The `schema` index should be updated when a new plotly.js version is released.
132+
133+
**How to exclude files from an index:** Each search index has its own Jekyll config (`_config_python_search.yml`, `_config_r_search.yml`, etc.) with an `algolia.excluded_files` list. Add files or paths there to keep them out of search results.
134+
135+
**Algolia API key:** Updating the indices requires a private Algolia API key set as an environment variable. Request it from a Plotly maintainer via an issue on this repository.
136+
137+
Run `make help` to see all available `make` targets, including search-index and upstream-fetch commands.
118138

119139
## Other Documentation
120140

121141
This repository also contains:
122-
- Plotly's Node.js, Matlab, Scala, Julia, and Python V3 graphing libraries documentation
123-
- the reference pages for Plotly's JavaScript, Python, R, and Matlab graphing libraries.
124-
142+
- Plotly's Node.js, Scala, and Python V3 graphing libraries documentation
143+
- the reference pages for Plotly's JavaScript, Python, R, and Matlab graphing libraries
144+
- landing/index pages for the Python, R, ggplot2, Julia, Matlab, C#, and F# docs (the tutorial content for those languages is fetched from upstream repos at build time)

_posts/julia/README.md

Lines changed: 13 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,23 @@
11
# Contribute to Plotly's [Julia Documentation](https://plotly.com/julia/)
2-
## Initial Steps:
3-
0. Clone the repo.:
42

5-
```
6-
$ git clone git@github.com:plotly/graphing-library-docs.git
7-
$ cd graphing-library-docs
8-
```
9-
1. Check Ruby version `$ ruby --version`. We recommend using `version 2.3.3` or the same ruby version as gh-pages: https://pages.github.com/versions/. Note [RVM](https://rvm.io/rvm/install) is helpful for installing and managing ruby versions.
3+
The Julia tutorial content displayed on https://plotly.com/julia/ is **not** authored in this repository. It lives in [plotly/plotlyjs.jl-docs](https://github.com/plotly/plotlyjs.jl-docs) and is fetched into this repo at build time by `make fetch_upstream_files`.
104

11-
2. Install bundler and a couple dependencies from the gemfile:
5+
## Where to make changes
126

13-
```
14-
$ gem install bundler
15-
$ bundle install
7+
- **Tutorial content (chart examples, prose, etc.):** edit the source files in [plotly/plotlyjs.jl-docs](https://github.com/plotly/plotlyjs.jl-docs). See that repo's README for authoring instructions.
8+
- **The Julia landing/index pages** that appear on https://plotly.com/julia/ (sidebar, categories, etc.): edit the corresponding files in this repository under `_posts/julia/` and the include files under `_includes/`.
169

17-
```
18-
<b>IMPORTANT</b> -If not using bundler and the gemfile, [install the same jekyll version that GitHub Pages is using](https://pages.github.com/versions/).
10+
## Building locally
1911

20-
## Create Julia Documentation:
21-
Our Julia tutorials are written in HTML files with embedded plot examples.
22-
##### In `documentation/_posts/julia`
23-
1. Create a folder titled with the chart type or topic you're adding to the documentation (i.e. `bar`)
24-
2. `cd` into the folder you created and create an html index file labeled: `yyyy-mm-dd-chart_type_julia_index.html`. Copy the index file template below and replace with the necessary information pertaining to the doc you are creating.
25-
```
26-
---
27-
title: Julia Add-Chart-Type-or-Topic | Examples | Plotly
28-
name: Add-Chart-Type-or-Topic
29-
permalink: julia/add-chart-type-or-topic/
30-
description: How to make a add-chart-type-or-topic in Julia. Add an additional sentence summarizing chart-type or topic.
31-
layout: base
32-
thumbnail: thumbnail/add-chart-type-or-topic.jpg *MORE INFO ON ADDING THUMBNAILS BELOW
33-
language: julia
34-
page_type: example_index
35-
display_as: **SEE BELOW
36-
order: ***SEE BELOW
37-
---
38-
{% assign examples = site.posts | where:"language","julia" | where:"suite","add-chart-type-or-topic"**** | sort: "order" %}
39-
{% include posts/auto_examples.html examples=examples %}
40-
```
41-
- **`display_as` sets where your tutorial is displayed
42-
- 'basic' = https://plotly.com/julia/#basic-charts
43-
- 'statistical' = https://plotly.com/julia/#statistical-charts
44-
- 'scientific' = https://plotly.com/julia/#scientific-charts
45-
- 'financial' = https://plotly.com/julia/#financial-charts
46-
- 'maps' = https://plotly.com/julia/#maps
47-
- '3d_charts' = https://plotly.com/julia/#3d-charts
48-
- See additional options [HERE](https://github.com/plotly/graphing-library-docs/blob/master/_includes/documentation_eg.html#L1)
49-
- *** `order` defines the order in which the tutorials appear in each section on plot.ly/julia. Please take a look at https://plotly.com/julia/ and order your tutorial next to similar chart types. <b>Note</b> `order` can be a float.
12+
To preview Julia documentation locally, follow the setup steps in the main [README.md](https://github.com/plotly/graphing-library-docs/blob/master/README.md#how-to-get-the-application-working-locally), then run:
5013

51-
3. Create an example and save it on https://plotly.com/.
14+
```sh
15+
make fetch_upstream_files
16+
bundle exec jekyll serve --config _config_dev.yml
17+
```
5218

53-
4. Add an HTML file (`yyyy-mm-dd-example-name.html`) for each example. The HTML file should have a header (template below), followed by the Julia code used to create the example.
54-
```
55-
---
56-
name: Basic Bar Chart **
57-
plot_url: https://plotly.com/~PlotBot/39
58-
language: julia
59-
suite: bar
60-
order: 1 **
61-
sitemap: false
62-
arrangement: horizontal
63-
---
64-
# Learn about API authentication here: https://plotly.com/julia/getting-started
65-
# Find your api_key here: https://plotly.com/settings/api
19+
`fetch_upstream_files` clones the latest built Julia content into `_posts/julia/html/`. Without it, the Julia pages will not render locally.
6620

67-
using Plotly
21+
## Pull requests
6822

69-
70-
data = [
71-
[
72-
"x" => ["giraffes", "orangutans", "monkeys"],
73-
"y" => [20, 14, 23],
74-
"type" => "bar"
75-
]
76-
]
77-
response = Plotly.plot(data, ["filename" => "basic-bar", "fileopt" => "overwrite"])
78-
plot_url = response["url"]
79-
```
80-
81-
6. Best Practices:
82-
- <b>Now we have an awesome navigation bar on the left side of our tutorial pages.</b> The navigation bar displays the `name`** in the `order`** so add a `name` for each example and try to make `name`s as informative and concise as possible. Ex: `Basic Bar Chart`
83-
- `order` examples from basic -> advanced.
84-
- Try to use "real" data, to make the examples realistic and interesting. Avoid including large datablocks in the tutorial by uploading the datafile to https://github.com/plotly/datasets. Importing data rather than pasting a large chunk of data in the tutorial creates a cleaner example. (Using random data is okay for some examples too :) )
85-
86-
8. Add Thumbnail Images
87-
- Thumbnail images should named `your-tutorial-chart.jpg` and be *EXACTLY* 160px X 160px
88-
- Thumbnail images should be clear and interesting. You do not need to capture the ENTIRE chart, but rather focus on the most interesting part of the chart.
89-
- Use images.plot.ly for adding new images.
90-
- Log-in here: https://661924842005.signin.aws.amazon.com/console
91-
- Username: Plotly_Editors
92-
- From the <b>Amazon Web Services Console</b> select <b>S3 (Scalable Storage in the Cloud)</b> then select <b>plotly-tutorials</b> -> <b>plotly-documentation</b> -> <b>thumbnail</b>
93-
- Now from <b>All Buckets /plotly-tutorials/plotly-documentation/thumbnail</b> select the <b>Actions</b> dropdown and <b>upload</b> your .jpg file
94-
95-
##### In the terminal in the `documentation` repo
96-
9. Commit and Push your tutorial
97-
- `git add` your .html files
98-
- `git commit -m "include a message about the tutorial you're adding"`
99-
- `git push origin master`
100-
101-
10. To proof your work, serve the pages locally by running: `bundle exec jekyll serve --config _config_dev.yml` from the root of the documentation repo.
102-
For more information see these steps: https://github.com/plotly/graphing-library-docs/blob/master/Contributing.md
103-
104-
11. Deploy changes by running `bundle exec rake deploy` from the root of the documentation repo.
105-
106-
##### At https://plotly.com/julia
107-
12. Check your Tutorial!!!! This is a <b>very important</b> step.
108-
<b>PLEASE</b> visit https://plotly.com/julia/your-tutorial and make sure everything looks correct :)
109-
110-
- Some common problems that you should check for:
111-
- Make sure all plots/codepen embeds appear! (*you may want to sign out of your Plotly/codepen account to ensure you didn't accidentally embed private plots)
112-
- The thumbnail image appears on: https://plotly.com/julia/
113-
114-
Thanks for contributing to our documentation!!
23+
Open a pull request against the `master` branch of [plotly/graphing-library-docs](https://github.com/plotly/graphing-library-docs) for changes to the Julia landing pages, or against [plotly/plotlyjs.jl-docs](https://github.com/plotly/plotlyjs.jl-docs) for changes to tutorial content. A Plotly maintainer will review.

_posts/plotly_js/README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The easiest way to do this is to follow the `Edit this page on GitHub` link at t
1818

1919
For contributions such as new example posts, we recommend setting up a local development environment so that you can test your changes as you work on them.
2020

21-
**See the `How To Get The Application Working Locally` section of the [Contributing Guide](https://github.com/plotly/graphing-library-docs/blob/master/Contributing.md) to learn how to clone this repository to your local development environment and install its dependencies.**
21+
**See the `How To Get The Application Working Locally` section of the [Contributing Guide](https://github.com/plotly/graphing-library-docs/blob/master/README.md#how-to-get-the-application-working-locally) to learn how to clone this repository to your local development environment and install its dependencies.**
2222

2323
Then follow these instructions to create or modify a new post. If the post is the first of its chart type, you need to create an index page for it first.
2424

@@ -44,7 +44,7 @@ order: 5
4444
{% assign examples = site.posts | where:"language","plotly_js" | where:"suite","add-chart-type-or-topic"| sort: "order" %}
4545
{% include posts/auto_examples.html examples=examples %}
4646
```
47-
- Make sure to update `_includes/posts/documentation_eg.html`, `_includes/layouts/side-bar.html`, and `_data/display_as_py_r_js.yml` and the CI python scripts with the new chart type!
47+
- Make sure to update `_includes/posts/documentation_eg.html`, `_includes/layouts/side-bar.html`, and `_data/display_as_py_r_js.yml` with the new chart type. If the chart type needs to be tracked for front-matter or ordering validation, also update `front-matter-ci.py` and `check-or-enforce-order.py`.
4848

4949
- Index pages for chart categories must have `order: 5`.
5050

@@ -76,7 +76,7 @@ var data = [
7676
x: ['giraffes', 'orangutans', 'monkeys'],
7777
y: [20, 14, 23],
7878
type: 'bar'
79-
}The
79+
}
8080
];
8181
8282
Plotly.newPlot('myDiv', data);
@@ -108,10 +108,7 @@ Plotly.newPlot('myDiv', data);
108108
- 'maps' = https://plotly.com/javascript/maps
109109
- '3d_charts' = https://plotly.com/javascript/3d-charts
110110
- Thumbnail images should be clear and interesting. You do not need to capture the ENTIRE chart, but rather focus on the most interesting part of the chart.
111-
- Use images.plot.ly for adding new images. The password is in the Plotly 1Password Engineering Vault.
112-
- Log-in here: https://661924842005.signin.aws.amazon.com/console
113-
- From the <b>Amazon Web Services Console</b> select <b>S3 (Scalable Storage in the Cloud)</b> then select <b>plotly-tutorials</b> -> <b>plotly-documentation</b> -> <b>thumbnail</b>
114-
- Now from <b>All Buckets /plotly-tutorials/plotly-documentation/thumbnail</b> select the <b>Actions</b> dropdown and <b>upload</b> your .jpg file
111+
- Plotly hosts thumbnail images on `images.plot.ly`. If you do not have upload access, attach the image to your pull request and a maintainer will upload it on your behalf.
115112

116113
## Modify An Existing Post:
117114

@@ -142,7 +139,7 @@ Plotly.newPlot('myDiv', data);
142139
git commit -m 'message about your changes'
143140
git push origin your_feature_branch
144141
```
145-
- Visit the [documentation repo](https://github.com/plotly/graphing-library-docs) and open a pull request!. You can then tag **@jdamiba** for a review.
142+
- Visit the [documentation repo](https://github.com/plotly/graphing-library-docs) and open a pull request. A Plotly maintainer will review it.
146143
147144
## Style Edits
148145

0 commit comments

Comments
 (0)