- Elements - Building blocks of .chalk documents
- Attributes - Key-value pairs for element configuration and metadata
- Style Guide - Best practices and conventions
Language Guide
Complete guide to the .chalk language.
Table of Contents
Documents
A .chalk document consists of a series of elements that define structured content. These elements come in various types, each serving a specific purpose.
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
)
Elements
Elements are the building blocks of .chalk documents. They can be containers (holding other elements) or leaf elements (holding text or media).
See more in the Elements Reference.
Attributes
Element can be given attributes that configure its behaviour and additonal data.
See more in the Attributes Guide.
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.
See more in the API Documentation.
Additional Features
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
Comments are ignored during compilation and are meant for adding notes and explanations within the source code.
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)
section{
# This is a test scenario {{name}}
Laborum sint incididunt esse aliquip voluptate enim. Minim amet id commodo. Incididunt qui irure mollit.
@include(src: component.part.chalk)
}
.part.chalk Files
.chalk Element files containing single reusable components:
code{
Hello, World!
}(
language: typescript
interactive: true
)
- Contain exactly one root element or container
- Cannot be compiled independently (only included via
@include) - Designed for reusable components and templates
See more in the Meta-Elements section.