Skip to content

Commit 33bb522

Browse files
committed
make 'online_cdn_js' function public as well
- update changelog - fix clippy with latest Rust version Signed-off-by: Andrei Gherghescu <[email protected]>
1 parent be20b0c commit 33bb522

File tree

2 files changed

+48
-27
lines changed

2 files changed

+48
-27
lines changed

CHANGELOG.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,27 @@ All notable changes to this project will be documented in this file.
33

44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

6+
67
## [0.13.0] - 2025-xx-xx
78
### Changed
89
- [[#277](https://github.com/plotly/plotly.rs/pull/277)] Removed `wasm` feature flag and put evrything behind target specific dependencies. Added `.cargo/config.toml` for configuration flags needed by `getrandom` version 0.3 on `wasm` targets.
9-
- [[#281]((https://github.com/plotly/plotly.rs/pull/xxx))] Update to askama 0.13.0
10-
- [[#287]](https://github.com/plotly/plotly.rs/pull/287) Added functionality for callbacks (using wasm)
11-
- [[#289]](https://github.com/plotly/plotly.rs/pull/289) Fixes Kaleido static export for MacOS targets by removing `--disable-gpu` flag for MacOS
12-
- [[#291]](https://github.com/plotly/plotly.rs/pull/291) Remove `--disable-gpu` flag for Kaleido static-image generation for all targets.
13-
- [[#299]](https://github.com/plotly/plotly.rs/pull/299) Added customdata field to HeatMap
14-
- [[#303]](https://github.com/plotly/plotly.rs/pull/303) Split layout mod.rs into modules
15-
- [[#304]](https://github.com/plotly/plotly.rs/pull/304) Refactored examples to allow fo generation of full html files
10+
- [[#281](https://github.com/plotly/plotly.rs/pull/281)] Update to askama 0.13.0
11+
- [[#287](https://github.com/plotly/plotly.rs/pull/287)] Added functionality for callbacks (using wasm)
12+
- [[#289](https://github.com/plotly/plotly.rs/pull/289)] Fixes Kaleido static export for MacOS targets by removing `--disable-gpu` flag for MacOS
13+
- [[#291](https://github.com/plotly/plotly.rs/pull/291)] Remove `--disable-gpu` flag for Kaleido static-image generation for all targets.
14+
- [[#299](https://github.com/plotly/plotly.rs/pull/299)] Added customdata field to HeatMap
15+
- [[#303](https://github.com/plotly/plotly.rs/pull/303)] Split layout mod.rs into modules
16+
- [[#304](https://github.com/plotly/plotly.rs/pull/304)] Refactored examples to allow fo generation of full html files
17+
- [[#320](https://github.com/plotly/plotly.rs/pull/320)] Make offline_js_sources function `pub`
18+
- [[#321](https://github.com/plotly/plotly.rs/pull/321)] Make 'online_cdn_js' function also `pub` for consistenccy
19+
20+
### Added
21+
- [[#311](https://github.com/plotly/plotly.rs/pull/311)] Add extra themes
22+
- [[#312](https://github.com/plotly/plotly.rs/pull/312)] Add rangebreak to axis
23+
- [[#313](https://github.com/plotly/plotly.rs/pull/313)] Add example of subplots with multiple traces
24+
- [[#314](https://github.com/plotly/plotly.rs/pull/314)] Add axis range bounds support
25+
- [[#317](https://github.com/plotly/plotly.rs/pull/317)] Show rangebreak usage with ints
26+
- [[#318](https://github.com/plotly/plotly.rs/pull/318)] Add slider support
1627

1728
### Fixed
1829
- [[#284](https://github.com/plotly/plotly.rs/pull/284)] Allow plotly package to be compiled for android

plotly/src/plot.rs

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -495,35 +495,45 @@ impl Plot {
495495
}
496496
}
497497

498+
/// Returns HTML script tags containing embedded JavaScript sources for
499+
/// offline use.
500+
///
501+
/// This function embeds the Plotly.js library and MathJax (tex-svg)
502+
/// JavaScript directly into the HTML output, allowing plots to work
503+
/// without an internet connection. The embedded sources include:
504+
/// - Plotly.js library for interactive plotting
505+
/// - MathJax tex-svg for rendering mathematical expressions
506+
///
507+
/// This is used when the `plotly_embed_js` feature is enabled, providing
508+
/// self-contained HTML files that don't require external CDN resources.
498509
pub fn offline_js_sources() -> String {
499-
// tex-mml-chtml conflicts with tex-svg when generating Latex Titles
500-
// let local_tex_mml_js = include_str!("../templates/tex-mml-chtml-3.2.0.js");
510+
// Note that since 'tex-mml-chtml' conflicts with 'tex-svg' when generating
511+
// Latex Titles we no longer include it.
501512
let local_tex_svg_js = include_str!("../templates/tex-svg-3.2.2.js");
502513
let local_plotly_js = include_str!("../templates/plotly.min.js");
503514

504515
format!(
505-
"<script type=\"text/javascript\">{}</script>\n
506-
<script type=\"text/javascript\">
507-
/**
508-
* tex-svg JS script
509-
**/
510-
{}
511-
</script>\n
512-
<script type=\"text/javascript\">
513-
/**
514-
* tex-mml-chtml JS script
515-
**/
516-
{}
517-
</script>\n
518-
",
519-
local_plotly_js, local_tex_svg_js, ""
516+
"<script type=\"text/javascript\">{local_plotly_js}</script>\n
517+
<script type=\"text/javascript\">{local_tex_svg_js}</script>\n"
520518
)
521519
.to_string()
522520
}
523521

524-
fn online_cdn_js() -> String {
525-
// Removed tex-mml-chtml as it conflicts with tex-svg when generating Latex
526-
// Titles
522+
/// Returns HTML script tags that reference external CDN resources for
523+
/// online use.
524+
///
525+
/// This function provides HTML script tags that load JavaScript libraries
526+
/// from external CDN sources, requiring an internet connection to
527+
/// function. The referenced sources include:
528+
/// - Plotly.js library from CDN (version 3.0.1)
529+
/// - MathJax tex-svg from jsDelivr CDN (version 3.2.2)
530+
///
531+
/// This is the default behavior when the `plotly_embed_js` feature is
532+
/// disabled, providing smaller HTML files that rely on external
533+
/// resources.
534+
pub fn online_cdn_js() -> String {
535+
// Note that since 'tex-mml-chtml' conflicts with 'tex-svg' when generating
536+
// Latex Titles we no longer include it.
527537
r##"<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
528538
<script src="https://cdn.plot.ly/plotly-3.0.1.min.js"></script>
529539
"##

0 commit comments

Comments
 (0)