How It Works
Before writing any code, it helps to see the full pipeline. A Markdown file enters one end, a rendered HTML page comes out the other. Here's every step in between.
The pipeline
What each step means
Step 1 — LiteNode parses the file. You call app.parseMarkdownFile("filename.md") and LiteNode reads the file, splits it into two parts, and returns them as an object.
Step 2 — Two things come out. The frontmatter (the YAML block at the top of the file) becomes a plain JavaScript object. The rest of the file — the actual Markdown — comes out as a raw string.
Step 3 — Each part is processed separately. You destructure the fields you need from frontmatter (title, description, etc.). You pass the content string to marked.parse(), which returns an HTML string.
Step 4 — One data object goes into the template. You pass both the frontmatter data and the HTML string together into res.render().
Step 5 — LiteNode renders the template. Your HTML template receives the data object and produces the final page the browser sees.
What this looks like in code
app.get("/article", (req, res) => {
// Step 1: parse
const parsed = app.parseMarkdownFile("pages/article.md")
// Steps 2-3: extract and convert
const { title, description } = parsed.frontmatter
const html_content = marked.parse(parsed.content)
// Steps 4-5: render
res.render("layouts/index.html", { title, description, html_content })
})
That's the entire loop. Everything else in this tutorial builds on this pattern.
