### Install and Run Pluto.jl Source: https://github.com/juliapluto/pluto.jl/blob/main/README.md To install and run Pluto, start a Julia session and execute the provided commands. Refer to the official installation guide for a complete setup. ```julia import Pluto Pluto.run() ``` -------------------------------- ### Install and Build Frontend Bundles Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend-bundler/README.md These commands install dependencies, clean previous build artifacts, and then build the frontend bundles. Run these from the 'frontend-bundler' directory. ```bash cd frontend-bundler npm install rm -rf ../frontend/.parcel-cache rm -rf ../frontend-dist rm -rf ../frontend-dist-offline npm run build npm run build-offline ``` -------------------------------- ### Install Frontend Dependencies Source: https://github.com/juliapluto/pluto.jl/blob/main/test/frontend/README.md Installs the necessary Node.js packages for running frontend tests. This should be run before executing any tests. ```bash npm install ``` -------------------------------- ### Install Frontend Dependencies and Type Check Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/imports/README.md Navigate to the frontend directory to install dependencies, then return to the root and run a type check. This ensures that the frontend code is correctly set up and adheres to TypeScript standards after dependency changes. ```bash cd frontend && npm install cd .. && tsc --noEmit --strictNullChecks false ``` -------------------------------- ### Greek Localization Example Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md An example of a JSON localization file for the Greek language, showing key-value pairs for UI text. ```js "t_edit_or_run_view_code_cancel": "{{icon}} Ακύρωση", "t_edit_or_run_description_1": "Για να μπορέσετε να επεξεργαστείτε κώδικα και να εκτελέσετε κύτταρα, πρέπει να εκτελέσετε το σημειωματάριο μόνοι σας.", "t_edit_or_run_description_2": "Πού θα θέλατε να εκτελέσετε το σημειωματάριο;", "t_binder_help_text_title": "Στο cloud (πειραματική λειτουργία)" ``` -------------------------------- ### Running Pluto with a Sysimage Source: https://github.com/juliapluto/pluto.jl/wiki/⚡-Writing-and-running-code Use the `sysimage` keyword argument in `Pluto.run()` to specify a sysimage for notebooks. This example loads the currently active sysimage. ```julia Pluto.run(sysimage=unsafe_string(Base.JLOptions().image_file)) ``` -------------------------------- ### Revert to Normal Pluto.jl Installation Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md Removes the development package and reverts to the standard Pluto.jl installation. Run this when you are finished testing local changes. ```julia ] add Pluto ``` -------------------------------- ### Pluralization Example in JSON Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md Illustrates how to handle pluralization in localization strings using suffixes like _one, _other, and _zero, along with interpolation for counts. ```json "t_new_messages_zero": "You have no new messages 🥺", "t_new_messages_one": "You have {{count}} new message", "t_new_messages_other": "You have {{count}} new messages" ``` -------------------------------- ### Run Pluto.jl Server with Custom Port Source: https://github.com/juliapluto/pluto.jl/blob/main/test/frontend/README.md Starts the Pluto.jl server on a specified port, disabling browser launch and secret authentication. This is useful for running tests or development. ```bash PLUTO_PORT=2345; julia --project=/path/to/PlutoDev -e "import Pluto; Pluto.run(port=$PLUTO_PORT, require_secret_for_access=false, launch_browser=false)" ``` ```bash PLUTO_PORT=2345; julia -e "import Pluto; Pluto.run(port=$PLUTO_PORT, require_secret_for_access=false, launch_browser=false)" ``` -------------------------------- ### Add Local Pluto.jl as Development Package Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md Installs your local copy of Pluto.jl as a development package in Julia. This allows you to test your frontend changes in real-time. ```julia ] dev ~/Desktop/Pluto.jl ``` -------------------------------- ### TypeScript Circular Definition Error Example Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/imports/README.md Illustrates a broken TypeScript scenario where a wrapper file's name causes a circular definition error when importing from the same module. ```typescript // inside lodash.d.ts — BROKEN: TypeScript resolves "lodash" back to this very file import _ from "lodash" export default _ ``` -------------------------------- ### Build Frontend Distribution Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/imports/README.md Clean the frontend cache and distribution folders, then build the frontend distribution. This step is crucial for testing the bundled version of the application. ```bash rm -rf ../frontend/.parcel-cache ../frontend-dist ../frontend-dist-offline npm run build ``` -------------------------------- ### Running Pluto with a Specific Notebook Source: https://github.com/juliapluto/pluto.jl/wiki/⚡-Writing-and-running-code You can specify a notebook to be loaded upon launching Pluto by passing the `notebook` keyword argument to `Pluto.run()`. ```julia Pluto.run(notebook="/path/to/notebook.jl") ``` -------------------------------- ### Run Frontend Tests Source: https://github.com/juliapluto/pluto.jl/blob/main/test/frontend/README.md Executes the frontend test suite using npm. Ensure the Pluto.jl server is running and accessible on the specified port. ```bash PLUTO_PORT=2345 npm run test ``` -------------------------------- ### Create New Language JSON File Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md This snippet shows the initial structure for a new language JSON file. Replace 'Ελληνικά' with the name of your language in its native script. ```json { "t_language_name": "Ελληνικά" } ``` -------------------------------- ### Run Tests with Browser View Enabled Source: https://github.com/juliapluto/pluto.jl/blob/main/test/frontend/README.md Runs the frontend tests with the browser visible, useful for debugging. The HEADLESS=false environment variable controls this behavior. ```bash clear && HEADLESS=false PLUTO_PORT=1234 npm run test ``` -------------------------------- ### Synchronize Language JSON Files Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md Run this script to update language JSON files with new keys from the English file. This ensures all translatable strings are present. ```julia julia update_languages.jl ``` -------------------------------- ### Pluto.jl Welcome Message Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/editor.html This snippet displays the welcome message for Pluto.jl, including the project name and contributors. ```javascript console.log( "Pluto.jl, by Fons van der Plas (https://github.com/fonsp), Mikołaj Bochenski (https://github.com/malyvsen), Michiel Dral (https://github.com/dralletje), Παναγιώτης (Panagiotis) Γεωργακόπουλος (https://github.com/pankgeorg), Paul Berg (https://github.com/Pangoraw) and friends 🌈" ) ``` -------------------------------- ### Displaying Output Instead of Using `display` Source: https://github.com/juliapluto/pluto.jl/wiki/⚡-Writing-and-running-code In Pluto.jl, simply output the value you want to show. The last subexpression in a block is the output value. Avoid using `display()` for notebook output. ```julia begin x = 25.0 display(sqrt(x)) end ``` ```julia begin y = 0.1 display(cos(y)) display(sin(y)) end ``` ```julia begin x = 25.0 sqrt(x) end ``` ```julia begin y = 0.1 cos(y), sin(y) end ``` -------------------------------- ### Run Specific Test Suite Source: https://github.com/juliapluto/pluto.jl/blob/main/test/frontend/README.md Executes a particular test suite by appending the suite name with the -t flag. This allows for focused testing. ```bash clear && HEADLESS=false PLUTO_PORT=1234 npm run test -- -t=PlutoAutocomplete ``` -------------------------------- ### Corrected TypeScript Dependency Naming Convention Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/imports/README.md Demonstrates the correct naming convention using a suffix to avoid TypeScript circularity issues when wrapper filenames might collide with npm package names. ```typescript lodash-es.js ← wrapper; imports from cdn.jsdelivr.net/npm/lodash@…/+esm lodash-es.d.ts ← type stub; imports from "lodash" (@types/lodash) without any circularity ``` -------------------------------- ### Using the t function for translations Source: https://github.com/juliapluto/pluto.jl/blob/main/frontend/lang/README.md Demonstrates the correct way to use the `t` function for translatable strings in JavaScript, instead of direct string literals in functions like `confirm`. ```js if(confirm(t("t_delete_cell_confirm"))) { // ... } ``` -------------------------------- ### Force Test Failure for Non-Crashing Errors Source: https://github.com/juliapluto/pluto.jl/blob/main/test/frontend/README.md Introduces a test failure by logging a specific error message to the console. This is used to mark handled but problematic situations. ```javascript console.error("PlutoError ...") ``` -------------------------------- ### Modifying Variables Across Cells Source: https://github.com/juliapluto/pluto.jl/wiki/⚡-Writing-and-running-code Variables can only be assigned and modified in a single cell to maintain reactivity. Use `begin...end` or `let...end` blocks to group modifications, or rename variables to avoid conflicts. ```julia "I have $(n_today) pets" ``` ```julia begin n_today = n_yesterday n_today += 3 n_today *= 2 end ``` ```julia n_yesterday = 0 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.