Skip to main content Svelte Highlight v7.21.1

CUE language preview

1. Schema and constraints

definitions, types, and field constraints
horizon-dark
package config

#Server: {
	host:    string
	port:    int & >0 & <65536
	tls:     bool | *false
	timeout: string | *"30s"
}

production: #Server & {
	host: "example.com"
	port: 443
	tls:  true
}
atom-one-dark
package config

#Server: {
	host:    string
	port:    int & >0 & <65536
	tls:     bool | *false
	timeout: string | *"30s"
}

production: #Server & {
	host: "example.com"
	port: 443
	tls:  true
}
github-dark
package config

#Server: {
	host:    string
	port:    int & >0 & <65536
	tls:     bool | *false
	timeout: string | *"30s"
}

production: #Server & {
	host: "example.com"
	port: 443
	tls:  true
}
dracula
package config

#Server: {
	host:    string
	port:    int & >0 & <65536
	tls:     bool | *false
	timeout: string | *"30s"
}

production: #Server & {
	host: "example.com"
	port: 443
	tls:  true
}
nord
package config

#Server: {
	host:    string
	port:    int & >0 & <65536
	tls:     bool | *false
	timeout: string | *"30s"
}

production: #Server & {
	host: "example.com"
	port: 443
	tls:  true
}
github
package config

#Server: {
	host:    string
	port:    int & >0 & <65536
	tls:     bool | *false
	timeout: string | *"30s"
}

production: #Server & {
	host: "example.com"
	port: 443
	tls:  true
}

2. Comprehensions

for expressions and string interpolation
horizon-dark
names: ["app", "api", "web"]

services: {
	for name in names {
		"\(name)": {
			image: "registry/\(name):latest"
		}
	}
}
atom-one-dark
names: ["app", "api", "web"]

services: {
	for name in names {
		"\(name)": {
			image: "registry/\(name):latest"
		}
	}
}
github-dark
names: ["app", "api", "web"]

services: {
	for name in names {
		"\(name)": {
			image: "registry/\(name):latest"
		}
	}
}
dracula
names: ["app", "api", "web"]

services: {
	for name in names {
		"\(name)": {
			image: "registry/\(name):latest"
		}
	}
}
nord
names: ["app", "api", "web"]

services: {
	for name in names {
		"\(name)": {
			image: "registry/\(name):latest"
		}
	}
}
github
names: ["app", "api", "web"]

services: {
	for name in names {
		"\(name)": {
			image: "registry/\(name):latest"
		}
	}
}

3. Byte strings and optional fields

'...' byte strings and the ? optional marker
horizon-dark
#Config: {
	secret?: string
	salt:    bytes | 'default-salt'
}
atom-one-dark
#Config: {
	secret?: string
	salt:    bytes | 'default-salt'
}
github-dark
#Config: {
	secret?: string
	salt:    bytes | 'default-salt'
}
dracula
#Config: {
	secret?: string
	salt:    bytes | 'default-salt'
}
nord
#Config: {
	secret?: string
	salt:    bytes | 'default-salt'
}
github
#Config: {
	secret?: string
	salt:    bytes | 'default-salt'
}