JuliaPluto/PlutoUI.jl

A Pluto version warning

Open

#61 opened on Oct 17, 2020

View on GitHub
 (1 comment) (0 reactions) (0 assignees)Julia (314 stars) (60 forks)auto 404
good first issue

Description

Use like:

PlutoUI.PlutoVersionWarning(v"0.12.1")

will output nothing when the version is higher than 0.12.1, and output a big warning when it is not.

I already wrote this, it just needs to be polished up and put into this package

html"""
<script>
const warning = html`
<h2 style="color: #800">Oopsie! You need to update Pluto to the latest version</h2>
<p>Close Pluto, go to the REPL, and type:
<pre><code>julia> import Pkg
julia> Pkg.update("Pluto")
</code></pre>
`

// this needs some work: in Pluto 0.12.0 you get Pluto's version number as:
// window.version_info_pluto

// in Pluto <0.12 it is:
// window.pluto_version

// I THINK but you should check
// https://github.com/fonsp/Pluto.jl/blob/master/CONTRIBUTING.md#how-to-run-specific-version-of-pluto

// for this code, I just wanted to warn for <0.12.1, but you should make it more general
const super_old = window.version_info == null || window.version_info.pluto == null
if(super_old) {
	return warning
}
const version_str = window.version_info.pluto.substring(1)
const numbers = version_str.split(".").map(Number)
console.log(numbers)

if(numbers[0] > 0 || numbers[1] > 12 || numbers[2] > 1) {
	
} else {
	return warning
}

</script>

"""

Contributor guide