Code blocks
Code blocks have a compact header automatically. This example site enables
params.features.codeBlock.folding.enable with an eight-line preview. Set
folding.previewLines to change the preview length or folding.enable: false
to show all code. Use codeBlock.copyButton.enable to control copying.
A long example
Copy includes the complete configuration, even while only its preview is visible.
baseURL: "https://example.com/"
languageCode: "en-us"
title: "My portfolio"
params:
features:
codeBlock:
copyButton:
enable: true
folding:
enable: true
previewLines: 8
footer:
enable: true
newsletter:
enable: false
Initially expanded, without line numbers
This block starts expanded and can still be folded. Its Copy button preserves the complete source without relying on the highlighted markup.
package main
import "fmt"
func main() {
fmt.Println("Hello, Toha!")
}
Plain text
Code without a language supports the same controls.
Starting build…
Loading configuration
Rendering pages
Writing assets
Build complete
A short snippet
Short examples stay fully visible.
echo "Hello, Toha!"
