Skip to main content

Codeblock in Markdown file

This code block below is generated in markdown and rendered by a ContentDoc tag in a .vue page. Vue components and html can also be embedded in the page if you need to do it.

The section below is text in markdown. CSS styles on this page are scoped to the blog.vue page.

Node.js sample code, formatted

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});

server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});