Prism language support
Prism templates use the .prism.html extension. Almasix ships a first-party
formatter in the framework, and editor grammar assets in
almasix-dev/ide-support (prism/), so
every tool — editors, pre-commit, CI — shares one language surface.
The Prism mark (optical prism + spectrum) lives in
art/prism/ —
use prism-file.svg for .prism.html file icons in editor packages.
Full VS Code / JetBrains packaging is covered in Editor setup.
Grammar (TextMate)
Section titled “Grammar (TextMate)”prism/syntaxes/prism.tmLanguage.json
highlights:
- HTML host markup
- Escaped echoes
{{ … }}and raw echoes{!! … !!} - Comments
{{-- … --}} @python/@endpythonblocks as embedded Python- Directives:
@if/@elseif/@else/@unless/@isset/@empty/@for/@foreach/@forelse/@while, layout and includes, components and slots, stacks, auth / gates,@csrf/@asset/@lang/@choice/@cache/@dump/@dd/@vite/@route, and matching@end*closers
Scope name: text.html.prism.
Language configuration
Section titled “Language configuration”prism/language-configuration.json
sets:
- Block comments
{{--/--}} - Auto-closing pairs for echoes and brackets
- Folding markers on open / close directives
- Indentation rules for directives and HTML tags
Snippets
Section titled “Snippets”prism/snippets/prism.code-snippets
covers common directives (@if, @foreach, @section, @auth, @python, …)
plus <x-…> components and slots.
Tree-sitter
Section titled “Tree-sitter”prism/tree-sitter-prism/
is a minimal grammar that recognizes comment, echo, raw_echo,
directive, and html_text, with queries/highlights.scm for Neovim /
Helix / Zed. Build steps are documented in the
ide-support prism/README.md.
Formatter
Section titled “Formatter”Library entry point (framework package):
from almasix.prism.formatter import format_prism
formatted = format_prism(source, indent_size=4, line_length=120)The formatter is idempotent and directive-aware. It indents HTML-ish
structure and Prism directives. Content between @python and @endpython is
not reindented.
CLI (registered by PrismServiceProvider):
smith prism:format # write under cwdsmith prism:format resources/views # directory or filesmith prism:format --check # CI: fail if would change--write is the default when --check is not set.
Loading in VS Code / Cursor
Section titled “Loading in VS Code / Cursor”Prefer the official extension from the Marketplace or
almasix-dev/ide-support Releases
— see Editor setup.