Skip to content

F1 Technical HUD

(A holographic display flickers to life. T.A. Watts is tapping on the glass.)
”Don’t memorize the manual. Memorize where to find the answers. Here is your heads-up display.”

ComponentHTMLPugNote
Div Class<div class="box">.boxDiv is default.
ID<h1 id="title">h1#titleHash for ID.
Attributes<input type="text">input(type="text")Use parens.
Text<p>Hello</p>p HelloSpace after tag.
Block Text(Multiline)p.Dot for block.
TypeSymbolExampleOutput
Buffered=h1= titleOutput to HTML (Escaped).
Unbuffered-- const x = 1Silent Execution.
Unescaped!=div!= htmlDANGER (Raw HTML).
Interpolation#{}p Hello #{name}Mix text & vars.
ManeuverSyntaxkey
Corneringif user.isLoggedNo parens needed.
AlternativeelseIndent below if.
Switchcase statusUse when "val".
Lapseach item in listIterate arrays.
Pit Stopinclude path/fileStatic insertion.
Chassisextends layoutUse with block.

[!WARNING] Check Engine Light (Common Errors):

  1. Mixed Indentation: Using tabs and spaces in the same file. (Instant crash).
  2. Missing Space: h1Title instead of h1 Title.
  3. Self-Closing: Trying to use img() instead of img. Pug knows which tags self-close.
Terminal window
npm install pug
app.set("view engine", "pug");
app.set("views", path.join(__dirname, "views"));