| id | narrative-schemas | |
|---|---|---|
litvis |
|
@import "../css/tutorial.less"
- Installing litvis
- Writing your first litvis documents
- Branching narratives
- Narrative schemas
You can skip this step if you already have Node.js and npm working on your system.
Node.js allows you to run JavaScript programs on your machine without a browser. It includes the package manager npm which litvis uses to install the supplementary packages needed to run litvis.
- Download and install the 'LTS' (Long Term Support) version of Node from nodejs.org/en/, accepting the default values during installation.
Litvis uses the programming language Elm to specify visualizations and process data. To install Elm, click the relevant installation for your computer from the official Elm install page (there's no need to follow the "after installation is complete..." tests).
All your datavis work with Litvis should be in a 'project'. The instructions below assume that the project folder will be Documents/datavis, but it can be anywhere on your computer.
-
Open a command window (type
cmdin the search field of the task bar in Windows, orapplications->utilities->terminalon a Mac). In this command window / terminal, enter the following (you can copy and paste the block of lines into the terminal window):cd Documents mkdir datavis cd datavis npm init --yes npm install prettier prettier-plugin-elm echo "{ \"plugins\": [\"prettier-plugin-elm\"] }" > .prettierrc.jsonIf you ever need to set up new litvis projects, create an appropriate folder on your computer, open up a terminal, change to that folder (using
cd) and issue the last three lines as above (fromnpm init --yesonwards). -
Close the command window / terminal by typing
exit
You will be writing your litvis documents in the VSCode text editor.
- Select the download Visual Studio Code from visualstudio.com and install with default settings.
VSCode is a general, but powerful editor that may be customised with 'extensions'. To use litvis and to make the process of editing and formatting code easier, you need to install some VSCode extensions written for and used by litvis. This is a one-off step to set things up. After configuring you should be able to edit and display litvis documents directly.
-
Start the VSCode editor.
-
In VSCode, press the extensions button on the left that looks like a stack of four squares. This should open up a panel allowing you to install various VSCode extensions.
-
Enter 'litvis' in the extensions search field and click the 'install' button under Markdown Preview Enhanced with litvis. This will allow you to display formatted litvis documents in VSCode.
-
Enter 'prettier' in the search field and click the 'install' button under Prettier - Code formatter. This will help you format litvis documents as you edit them.
-
Enter 'elm tooling' in the search field and click the install button under Elm tooling taking care to select the correct extension that looks like a blue spanner. This provides supporting functionality when working with the Elm programming language, used extensively with litvis.
-
Close down VSCode. This will force the three extensions to be initialised the next time you start up VSCode.
-
Restart VSCode. Select the
Preferences->Settingsmenu item, which can be found in theFilemenu on Windows or theCodemenu on MacOS. -
Navigate to
Text Editor -> Formattingsection and ensureFormat On Saveis ticked. This will ensure your code is always correctly formatted, saving much time and debugging effort.
-
Navigate to
Extensions -> Markdown Preview Enhanced with litvisand ensureLive Updateis not ticked. This will speed up Litvis so that the preview is only updated when you save modifications to your document.
-
You can now close the
Settingstab.
The easiest way to do this is to write your first litvis document.