Developer Portalthe documentation site for your API consumers
Hosting
Managed EdgeManaged DedicatedSelf-Hosted
Add syntax highlighting to your code blocks with customizable styling and features. The component
offers extensive customization options including line numbers, copy buttons, language indicators,
and custom theming to match your brand. For simpler use cases, you can also use standard Markdown
code blocks as described in Code Blocks.
You can also use backticks to highlight code blocks in Markdown files, see
Code Blocks for more information.
Import
Code
import { SyntaxHighlight } from "zudoku/ui/SyntaxHighlight";
using System;using System.Linq;public class UserService { private readonly List<User> _users = new(); public async Task<User?> GetUserAsync(int id) { await Task.Delay(100); return _users.FirstOrDefault(u => u.Id == id); }}
Rust
main.rs
use std::collections::HashMap;fn main() { let mut scores = HashMap::new(); scores.insert(String::from("Blue"), 10); scores.insert(String::from("Red"), 50); println!("Team scores: {:?}", scores);}
Ruby
todo_list.rb
class TodoList attr_reader :name, :items def initialize(name) @name = name @items = [] end def add_item(description) @items << { description: description, completed: false } endend
PHP
user.php
<?phpclass User { public function __construct( public readonly int $id, public readonly string $name, public readonly string $email ) {} public function getDisplayName(): string { return ucfirst($this->name); }}
HTML
index.html
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8" /> <title>Dev Portal Example</title> </head> <body> <h1>Welcome to Zudoku</h1> <p>Build beautiful documentation sites with ease.</p> <p> Nunc nec ornare libero. Sed ultricies lorem vitae enim vestibulum, at posuere augue ullamcorper. </p> </body></html>
import java.util.List;import java.util.stream.Collectors;public class UserService { private List<User> users; public List<User> getActiveUsers() { return users.stream() .filter(User::isActive) .collect(Collectors.toList()); }}
Go
main.go
package mainimport "fmt"type User struct { ID int Name string Email string}func main() { user := User{ID: 1, Name: "Alice", Email: "alice@example.com"} fmt.Printf("User: %+v\n", user)}
Kotlin
user.kt
data class User(val id: Long, val name: String, val email: String)class UserRepository { private val users = mutableListOf<User>() fun addUser(user: User) { users.add(user) } fun findById(id: Long): User? = users.find { it.id == id }}
case class User(id: Int, name: String, email: String)object UserRepository { private var users = List[User]() def addUser(user: User): Unit = { users = user :: users } def findById(id: Int): Option[User] = { users.find(_.id == id) }}
Dart
user.dart
class User { final int id; final String name; final String email; User({required this.id, required this.name, required this.email}); factory User.fromJson(Map<String, dynamic> json) { return User( id: json['id'], name: json['name'], email: json['email'], ); } Map<String, dynamic> toJson() => { 'id': id, 'name': name, 'email': email, };}
Elixir
user.ex
defmodule User do defstruct [:id, :name, :email] def new(id, name, email) do %User{id: id, name: name, email: email} end def display(%User{name: name, id: id}) do IO.puts("User: #{name} (ID: #{id})") endend# Usageuser = User.new(1, "Alice", "alice@example.com")User.display(user)
OCaml
user.ml
type user = { id : int; name : string; email : string;}let create_user id name email = { id; name; email }let display_user user = Printf.printf "User: %s (ID: %d)\n" user.name user.idlet () = let user = create_user 1 "Alice" "alice@example.com" in display_user user
Common Lisp
user.lisp
(defstruct user id name email)(defun create-user (id name email) (make-user :id id :name name :email email))(defun display-user (user) (format t "User: ~A (ID: ~A)~%" (user-name user) (user-id user)));; Usage(let ((user (create-user 1 "Alice" "alice@example.com"))) (display-user user))