Installation

This tutorial has four dependencies. That's it. Here's what each one does and why we need it.

Package Role
litenode The web framework — routing, templates, Markdown parsing
marked Converts Markdown text into HTML
highlight.js Syntax-highlights code blocks
marked-highlight Connects marked and highlight.js

Since our app will display code blocks, we need all four. Without code highlighting you'd only need LiteNode and Marked.

Create the project folder

Create a folder called litenode-markdown-app anywhere on your machine and open it in your code editor. A Markdown-aware editor like VS Codium will make the experience smoother.

Initialize the project

Open a terminal inside the folder and run:

npm init -y

This creates a package.json with sensible defaults. The -y flag skips all the prompts.

Install dependencies

npm i litenode marked highlight.js marked-highlight
Breaking change: Since version 3.0.0, LiteNode only supports ES modules. require() is not supported. Make sure you add "type": "module" to your package.json.

Enable ES modules

Open package.json and add "type": "module" so Node.js treats your files as ES modules:

{
    "name": "litenode-markdown-app",
    "version": "1.0.0",
    "main": "index.js",
    "type": "module",
    "scripts": {
        "start": "node index.js",
        "dev": "node --watch index.js",
        "build": "node functions/build.js"
    }
}

Replace the scripts block with the provided one. This will simplify launching and building the application later.

That's all the setup you need. In the next section we'll look at how a Markdown file flows through the system before writing any code.