Published
Edited
Feb 4, 2021
2 forks
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
input_str = Files.text(input_file)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
pluto_order_delimiter = "# ╠═"
Insert cell
pluto_order_delimiter_folded = "# ╟─"
Insert cell
Insert cell
output_str
Insert cell
function pluto_to_jup(input) {
const snacks = input.split(pluto_cell_delimiter);
// first snack is preamble, last snack is user defined order
// we ignore user defined order because Jupyter can only run cells top to bottom
const preamble = snacks[0];
const relevant_snacks = snacks.slice(1, snacks.length - 1);

// 37 is the 12th prime number
// 73 is the 21st prime number
const cells_code = [preamble, ...relevant_snacks.map(s => s.substring(37))];

return JSON.stringify(
{
cells: cells_code.map(code => ({
cell_type: "code",
execution_count: null,
metadata: {},
outputs: [],
source: jup_code_split(code)
})),

metadata: {
kernelspec: {
display_name: "Julia 1.0.0",
language: "julia",
name: "julia-1.0"
},
language_info: {
file_extension: ".jl",
mimetype: "application/julia",
name: "julia",
version: "1.0.0"
}
},
nbformat: 4,
nbformat_minor: 2
},
null,
2
);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
uuid = require('uuid@8.2.0/dist/umd/uuid.min.js')
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more