āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā š shadcn/directory/crafter-station/elements/shiki_usage ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
This guide shows you how to use the enhanced code blocks with diff highlighting, line highlighting, focus modes, and more.
[!code ++] and [!code --][!code highlight][!code focus][!code error] and [!code warning]// Show code changes
const oldFunction = () => {
console.log('old code'); // [!code --]
console.log('new code'); // [!code ++]
}
// [!code highlight:2]
function calculateTotal(items) {
return items.reduce((sum, item) => sum + item.price, 0);
}
Or highlight a single line:
const greeting = "Hello";
console.log(greeting); // [!code highlight]
const farewell = "Goodbye";
// [!code focus:2]
const important = "This is important";
const alsoImportant = "This too";
const lessImportant = "This is dimmed";
const correct = "This is correct";
const hasWarning = "Check this"; // [!code warning]
const hasError = "This is wrong"; // [!code error]
// [!code highlight:2]
function processData(data) {
const oldWay = data.map(x => x * 2); // [!code --]
const newWay = data.map(x => x ** 2); // [!code ++]
if (!data) {
throw new Error("Invalid data"); // [!code error]
}
return newWay;
}
All transformers use the new v3 matching algorithm for more intuitive line counting. In v3, the count starts from the line after the comment, not including the comment line itself.
Every code block automatically includes a copy button in the top-right corner:
All styles are defined in app/globals.css using OKLCH color space for consistent theming across light and dark modes.
ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā