Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve readme sync packages #5711

Merged
merged 2 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ To learn and build more with plotly.js please visit [plotly.js documentation](ht
### Un-minified versions are also available on CDN
While non-minified source files may contain characters outside UTF-8, it is recommended that you specify the `charset` when loading those bundles.
```html
<script src="https://cdn.plot.ly/plotly-2.0.0-rc.3.js" charset="utf-8"></script>
<script src="https://cdn.plot.ly/plotly-2.0.0-rc.3.js" charset="utf-8"></script>
```

> Please note that as of v2 the "plotly-latest" outputs (e.g. https://cdn.plot.ly/plotly-latest.min.js) will no longer be updated on the CDN, and will stay at the last v1 patch v1.58.4. Therefore, to use the CDN with plotly.js v2 and higher, you must specify an exact plotly.js version.

### To support MathJax
Load relevant MathJax (v2) files *Before* the plotly.js script tag:
```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG.js"></script>
<script src="https://cdn.plot.ly/plotly-2.0.0-rc.3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_SVG.js"></script>
<script src="https://cdn.plot.ly/plotly-2.0.0-rc.3.min.js"></script>
```

## Bundles
Expand Down
23 changes: 12 additions & 11 deletions tasks/sync_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function syncPartialBundlePkg(d) {
'',
'Contains trace modules ' + common.formatEnumeration(d.traceList) + '.',
'',
'For more info on plotly.js, go to https://github.com/plotly/plotly.js',
'For more info on plotly.js, go to https://github.com/plotly/plotly.js#readme',
'',
'## Installation',
'',
Expand All @@ -127,13 +127,14 @@ function syncPartialBundlePkg(d) {
'',
'```js',
'// ES6 module',
'import Plotly from \'' + d.name + '\';',
'import Plotly from \'' + d.name + '\'',
'',
'// CommonJS',
'var Plotly = require(\'' + d.name + '\');',
'var Plotly = require(\'' + d.name + '\')',
'```',
'',
copyrightAndLicense
copyrightAndLicense,
'Please visit [complete list of dependencies](https://www.npmjs.com/package/plotly.js/v/' + pkg.version + '?activeTab=dependencies).'
];

fs.writeFile(
Expand Down Expand Up @@ -209,7 +210,7 @@ function syncLocalesPkg(d) {
'',
d.desc,
'',
'For more info on plotly.js, go to https://github.com/plotly/plotly.js',
'For more info on plotly.js, go to https://github.com/plotly/plotly.js#readme',
'',
'## Installation',
'',
Expand All @@ -222,15 +223,15 @@ function syncLocalesPkg(d) {
'',
'```js',
'// ES6 module',
'import Plotly from \'plotly.js\';',
'import locale from \'' + d.name + '/fr' + '\';',
'import Plotly from \'plotly.js\'',
'import locale from \'' + d.name + '/fr' + '\'',
'',
'// CommonJS',
'var Plotly = require(\'plotly.js\');',
'var locale = require(\'' + d.name + '/fr\');',
'var Plotly = require(\'plotly.js\')',
'var locale = require(\'' + d.name + '/fr\')',
'',
'// then',
'Plotly.register(locale);',
'Plotly.register(locale)',
'Plotly.setPlotConfig({locale: \'fr\'})',
'```',
'',
Expand All @@ -248,7 +249,7 @@ function syncLocalesPkg(d) {
var cnt = [constants.licenseDist, ''];
localeFiles.forEach(function(f) {
var n = path.basename(f, '.js');
cnt.push('exports[\'' + n + '\'] = require(\'./' + n + '.js\');');
cnt.push('exports[\'' + n + '\'] = require(\'./' + n + '.js\')');
});
cnt.push('');

Expand Down