Complete guide to the Chalk language basics.
File Types
Chalk supports two file extensions for different use cases:
.chalk Files
Full Chalk documents that can be compiled independently:
*(
author: Test Author
description: Test Document
)
@const(x: 3; name: Test Scenario)
scene{
# This is a test scenario
Laborum sint incididunt esse aliquip voluptate enim. Minim amet id commodo. Incididunt qui irure mollit.
@include(src: component.chalke)
}
.chalke Files
Chalk Element files containing single reusable components:
code{
Hello, World!
}(
language: typescript
interactive: true
)
.chalke files:
- Contain exactly one root element or container
- Cannot be compiled independently (only included via
@include) - Designed for reusable components and templates
Both file types support the same Chalk syntax, but .chalke files are optimized for component reuse.
Documents
A Chalk document consists of a series of elements that define structured content. Documents can be compiled into various formats using libraries that define how elements should be processed.
Basic Document Structure
*(
title: My Document
author: John Doe
date: 2024-01-01
)
# Introduction
This is a paragraph of content.
## Section Header
More content here.
article{
# Article content goes here
This is the main content of the article.
}(
published: true
tags: news, featured
)
image(
src: sunset.jpg
alt: Sunset landscape
caption: Taken at dusk
)
Documents start with optional header attributes in *(...) syntax, followed by content elements.
Libraries
Libraries define the elements, attributes, and types available in Chalk documents. Every document requires a library to specify how its elements should be interpreted and compiled.
Libraries provide the rules and definitions that make Chalk documents meaningful and compilable.
Comments
Line comments start with // and continue to the end of the line. Comments can only appear at the beginning of lines (after whitespace), not inline within other content:
// This is a comment
# Title
Next Steps
- Language Guide - Back to language guide index
- Elements Reference - Learn about different element types
- Attributes Guide - Understand attribute syntax and types
- Formatting Guide - Inline text formatting
- Primitives Guide - Built-in elements and formatting
- API Documentation - Library usage and API reference
- Home - Back to documentation home