[codehighlight lang="python" cfgfile="lehi-config.json"]
# Simple Python example
def greet(name):
return f"Hello, {name}!"
print(greet("World"))
[/codehighlight]
[codehighlight lang="javascript" cfgfile="lehi-config.json" highlight="3,5-7"]
// JavaScript example with highlighted lines
function calculateSum(a, b) {
const result = a + b;
console.log("Sum:", result);
return result;
}
[/codehighlight]
[codehighlight lang="html" cfgfile="lehi-config.json" start_line="10"]
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<h1>Hello World</h1>
</body>
</html>
[/codehighlight]
[codehighlight lang="css" cfgfile="lehi-config.json"]
/* CSS Example */
.container {
display: flex;
justify-content: center;
align-items: center;
padding: 20px;
}
[/codehighlight]
[codehighlight lang="php" cfgfile="lehi-config.json" tryme_url="https://example.com"]
<?php
// PHP example with Try Me button
function factorial($n) {
if ($n <= 1) return 1;
return $n * factorial($n - 1);
}
echo factorial(5);
?>
[/codehighlight]
[codehighlight lang="sql" cfgfile="lehi-config.json" link_text="View Documentation" link_url="https://example.com/docs"]
-- SQL Example with custom link
SELECT users.name, orders.total
FROM users
INNER JOIN orders ON users.id = orders.user_id
WHERE orders.total > 100
ORDER BY orders.total DESC;
[/codehighlight]
[codehighlight lang="java" cfgfile="lehi-config.json"]
// Long Java example
public class Calculator {
private double result;
public Calculator() {
this.result = 0.0;
}
public void add(double value) {
this.result += value;
}
public void subtract(double value) {
this.result -= value;
}
public double getResult() {
return this.result;
}
}
[/codehighlight]
[codehighlight lang="bash" cfgfile="lehi-config.json"]
#!/bin/bash
# Short bash script example
echo "Starting backup..."
cp -r /source /backup
echo "Backup complete!"
[/codehighlight]