KB User's Guide - Syntax-highlighted Code Snippets Examples
This document provides examples of embedded code snippets in a KB document.
Bash/Shell
#!/usr/bin/env bash
set -euo pipefail
echo "Deploying application..."
docker compose up -d --build
C
#include <stdio.h>
int main(void) {
printf("Hello, KB!\n");
return 0;
}
C#
using System;
Console.WriteLine("Hello, KB!");
C++
#include <iostream>
int main() {
std::cout << "Hello, KB!\n";
return 0;
}
CSS
.notice {
padding: 1rem;
color: #123;
background: #eef6ff;
border-left: 4px solid #2b6cb0;
}
Go
package main
import "fmt"
func main() {
name := "KB"
fmt.Printf("Hello, %s!\n", name)
}
HTML
<article class="notice">
<h2>Hello, KB authors!</h2>
<p>Use <strong>semantic HTML</strong> when possible.</p>
</article>
Java
public class Greeting {
public static void main(String[] args) {
System.out.println("Hello, KB!");
}
}
JavaScript
const greeting = (name) => `Hello, ${name}!`;
document.querySelector("#message").textContent = greeting("KB");
Markdown
# Project Notes
Use **bold text** for key terms and `inline code` for commands.
## Checklist
- Review the documentation
- Run the test suite
- Deploy the update
[View the KnowledgeBase](https://kb.wisc.edu/)
PHP
<?php
function greeting(string $name): string
{
return "Hello, {$name}!";
}
echo greeting('KB');
Python
def greeting(name: str) -> str:
return f"Hello, {name}!"
print(greeting("KB"))
Ruby
def greeting(name)
"Hello, #{name}!"
end
puts greeting("KB")
SQL
SELECT id, title, updated_at
FROM articles
WHERE status = 'published'
ORDER BY updated_at DESC
LIMIT 10;
XML
<?xml version="1.0" encoding="UTF-8"?>
<book id="42">
<title>KnowledgeBase Guide</title>
<author active="true">KB Team</author>
</book>