Batteries
Syntax
Accent
Scheme
Backdrop motion
Batteries

Syntax

Text in, a tree out. Code is its tokens with structure over them: enough to colour, outline, fold and find things in 36 languages. Markdown is a whole document.
syntax.parseA node is {kind, value, from, to, text, children}. Over the tokens: a declaration (what, name), a call (name), a block, and a group for what is inside other brackets.
Language
js
194 characters, 11 lines
00000000000000000000000000000000000000000000000000
Edit it: the tree, the tokens and the outline below follow. from and to count characters as the page's text does.
…
Press a row to see the text it covers; a row with children folds.

The leaves

The same text as a flat run of tokens: what colouring wants.
syntax.tokensThe leaves in order as {kind, text}. What lies between them has kind "": joined, they are the text again.
Reading…
Show what lies betweenspaces as ·, line ends as ↵
0 tokens
reading…
syntax.linesThe same tokens, a list for each line: a for inside a for draws the code.
Reading…
0 lines; the small number at the end of each is how many tokens it holds. Highlight and the editor are drawn from this call.

Structure

An outline of declarationsWalk the tree for kind "declaration": each has what it is and its name. Bodies nest, by braces or by how far lines are set in.
Reading…
0 declarations in the js above. Pick another language at the top to see its own.
A language it does not knowThe call fails, and says so: a resource then has its else, or failure().
Languagetry js, or anything
syntax.tokens("let x = 1", …)
Reading…
Highlight shows such code plain instead of failing.
"markdown" is a documentheading (level), paragraph, list (ordered), item (checked), code (lang, code), quote, rule, table with row and cell, and inside them emphasis, strong, strike, codespan, link (url), image, text.
markdown
255 characters
00000000000000000000000000000000000000000000000000
The kit's Markdown component lays this same tree out as a page.
…
Press a row to see the text it covers; a row with children folds.
esc
Pages
StartStart
Buttons & badgesComponents
Cards & disclosureComponents
Dialogs & drawersComponents
Menus & commandsComponents
Dates & tablesComponents
ChartsComponents
Chart galleryComponents
FieldsComponents
ChoicesComponents
DisplayComponents
NavigationComponents
Popovers & sheetsComponents
MessagesChat & AI
Prompt inputChat & AI
Reasoning & toolsChat & AI
Developer partsChat & AI
ConversationChat & AI
Code artifactsChat & AI
VoiceChat & AI
Code blocksChat & AI
MarkdownChat & AI
EditorElements
TerminalElements
FlowElements
3D boxesElements
PaintElements
SurfaceElements
MediaElements
IconsElements
PrimitivesElements
SQLBatteries
StorageBatteries
Net & resourcesBatteries
Crypto & bytesBatteries
ZipBatteries
TablesBatteries
PDFBatteries
TimeBatteries
ImagesBatteries
ScanBatteries
Video & audioBatteries
SearchBatteries
SyntaxBatteries
PatternsBatteries
NotifyBatteries
ShareBatteries
State & logicLanguage
WorkersLanguage
Events & elementsLanguage
StylingLanguage
RoutesLanguage
ShortcutsLanguage
Long listsLanguage
Failures & tryLanguage
Back endBack end
Models & writesBack end
Rules & failuresBack end
Jobs & schedulesBack end
Running itBack end
ExtensionsBack end
AIBack end
AnalyticsBack end
AboutAbout
↑↓move
↵open
676 places · ranked by BM25