Urbit
  • Introduction
  • Development

    • Getting Started
    • Environment Setup
    • Grants Program
    • Project Repositories
    • Precepts
    • System Overview

      • Arvo
      • Hoon
      • Nock
      • Vere
      • Azimuth
      • Cryptography
      • Arvo

        • Overview
        • Ames

          • Overview
          • Cryptography
          • API Reference
          • Scry Reference
          • Data Types
          • Behn

            • Overview
            • API Reference
            • Scry Reference
            • Examples
            • Clay

              • Overview
              • Architecture
              • Using Clay
              • Data Types
              • Scry Reference
              • API Reference
              • Examples
              • Marks

                • Overview
                • Writing Marks
                • Using Marks
                • Examples
              • Dill

                • Overview
                • API Reference
                • Scry Reference
                • Data Types
                • Eyre

                  • Overview
                  • External API Reference
                  • Internal API Reference
                  • Scry Reference
                  • Data Types
                  • Guide
                  • Ford

                    • Overview
                    • Gall

                      • Overview
                      • API Reference
                      • Data Types
                      • Iris

                        • Overview
                        • API Reference
                        • Data Types
                        • Example
                        • Jael

                          • Overview
                          • API Reference
                          • Scry Reference
                          • Data Types
                          • Examples
                          • Concepts

                            • Scries
                            • Subscriptions
                            • Tutorials

                              • Move Trace
                              • Reference

                                • Cryptography
                                • Filesystem Hierarchy
                              • Userspace

                                • Overview
                                • HTTP API Guide
                                • Gall Guide

                                  • Introduction
                                  • 1. Arvo
                                  • 2. The Agent Core
                                  • 3. Imports and Aliases
                                  • 4. Lifecycle
                                  • 5. Cards
                                  • 6. Pokes
                                  • 7. Structures and Marks
                                  • 8. Subscriptions
                                  • 9. Vanes
                                  • 10. Scries
                                  • 11. Failure
                                  • 12. Next Steps
                                  • Appendix: Types
                                  • Full-Stack Walkthrough

                                    • 1. Introduction
                                    • 2. Types
                                    • 3. Agent
                                    • 4. JSON
                                    • 5. Marks
                                    • 6. Eyre
                                    • 7. React app setup
                                    • 8. React app logic
                                    • 9. Desk and glob
                                    • 10. Summary
                                    • Graph Store

                                      • Graph Store Overview
                                      • Data Structure Overview
                                      • Validator Walkthrough
                                      • Sample Application: Library
                                      • Graph Store - Reference
                                      • Advanced Info
                                      • Threads

                                        • Overview
                                        • HTTP API
                                        • Reference
                                        • Basics

                                          • Fundamentals
                                          • Bind
                                          • Input
                                          • Output
                                          • Summary
                                          • Gall

                                            • Start Thread
                                            • Take Result
                                            • Take Facts
                                            • Stop Thread
                                            • Poke Thread
                                            • Examples

                                              • Fetch JSON
                                              • Child Thread
                                              • Main-loop
                                              • Poke Agent
                                              • Scry
                                              • Take Fact
                                            • Distribution

                                              • Overview
                                              • Guide
                                              • Docket File
                                              • Glob
                                              • Dojo Tools
                                            • Hoon

                                              • Overview
                                              • Hoon School

                                                • 1.1 Introduction
                                                • 1.1.1 Walkthrough: List of Numbers
                                                • 1.2 Nouns
                                                • 1.3 Hoon Syntax
                                                • 1.3.1 Walkthrough: Conditionals
                                                • 1.4 Gates (Hoon Functions)
                                                • 1.4.1 Walkthrough: Recursion
                                                • 1.5 Lists
                                                • 1.5.1 Walkthrough: Fibonacci Sequence
                                                • 1.6 The Subject and Its Legs
                                                • 1.6.1 Walkthrough: Ackermann Function
                                                • 1.7 Arms and Cores
                                                • 1.7.1 Walkthrough: Caesar Cipher
                                                • 1.8 Doors
                                                • 1.8.1 Bank Account
                                                • 1.9 Generators
                                                • 2.1 Atoms, Auras, and Simple Cell Types
                                                • 2.2 Type Checking and Type Inference
                                                • 2.3 Structures and Complex Types
                                                • 2.3.1 Walkthrough: Libraries
                                                • 2.3.2 Molds
                                                • 2.4 Standard Library: Trees, Sets, and Maps
                                                • 2.5 Type Polymorphism
                                                • 2.5.1 Walkthrough: Iron Polymorphism and Wet Polymorphism
                                                • 2.5.2 Walkthrough: Lead Polymorphism
                                                • 2.6 Behn
                                                • 2.7 Gall
                                                • 2.7.1 Gall Walkthrough: Egg Timer
                                                • Guides

                                                  • CLI apps
                                                  • Parsing
                                                  • JSON
                                                  • Strings
                                                  • Sail (HTML)
                                                  • Writing Aqua Tests
                                                  • Reference

                                                    • Cheat Sheet
                                                    • Irregular forms
                                                    • Hoon Errors
                                                    • Hoon Style Guide
                                                    • Basic Types
                                                    • Advanced Types
                                                    • Auras
                                                    • Runes

                                                      • Atoms and strings
                                                      • Nock . ('dot')
                                                      • Wild ! ('zap')
                                                      • Change Subject = ('tis')
                                                      • Conditionals ? ('wut')
                                                      • Cores | ('bar')
                                                      • Arms + ('lus')
                                                      • Cells : ('col')
                                                      • Calls % ('cen')
                                                      • Casts ^ ('ket')
                                                      • Structures $ ('buc')
                                                      • Make ; ('mic')
                                                      • Hints ~ ('sig')
                                                      • Imports / ('fas')
                                                      • Terminators -- and ==
                                                      • Limbs and wings

                                                        • Limbs
                                                        • Wings
                                                        • Standard library

                                                          • Table of Contents
                                                          • 1a: Basic Arithmetic
                                                          • 1b: Tree Addressing
                                                          • 1c: Molds and Mold-Builders
                                                          • 2a: Unit Logic
                                                          • 2b: List Logic
                                                          • 2c: Bit Arithmetic
                                                          • 2d: Bit Logic
                                                          • 2e: Insecure Hashing
                                                          • 2f: Noun Ordering
                                                          • 2g: Unsigned Powers
                                                          • 2h: Set Logic
                                                          • 2i: Map Logic
                                                          • 2j: Jar and Jug Logic
                                                          • 2k: Queue Logic
                                                          • 2l: Container from Container
                                                          • 2m: Container from Noun
                                                          • 2n: Functional Hacks
                                                          • 2o: Normalizing Containers
                                                          • 2p: Serialization
                                                          • 2q: Molds and Mold-Builders
                                                          • 3a: Modular and Signed Ints
                                                          • 3b: Floating Point
                                                          • 3c: Urbit Time
                                                          • 3d: SHA Hash Family
                                                          • 3e: AES encryption (Removed)
                                                          • 3f: Scrambling
                                                          • 3g: Molds and Mold-Builders
                                                          • 4a: Exotic Bases
                                                          • 4b: Text Processing
                                                          • 4c: Tank Printer
                                                          • 4d: Parsing (Tracing)
                                                          • 4e: Parsing (Combinators)
                                                          • 4f: Parsing (Rule-Builders)
                                                          • 4g: Parsing (Outside Caller)
                                                          • 4h: Parsing (ASCII Glyphs)
                                                          • 4i: Parsing (Useful Idioms)
                                                          • 4j: Parsing (Bases and Base Digits)
                                                          • 4k: Atom Printing
                                                          • 4l: Atom Parsing
                                                          • 4m: Formatting Functions
                                                          • 4n: Virtualization
                                                          • 4o: Molds
                                                          • 5a: Compiler Utilities
                                                          • 5b: Macro Expansion
                                                          • 5c: Compiler Backend & Prettyprinter
                                                          • 5d: Parser
                                                          • 5e: Molds and mold builders
                                                          • 5f: Profiling support
                                                          • Zuse

                                                            • Table of Contents
                                                            • 2d(1-5): To JSON, Wains
                                                            • 2d(6): From JSON
                                                            • 2d(7): From JSON (unit)
                                                            • 2e(2-3): Print & Parse JSON
                                                        • Nock

                                                          • Nock Definition
                                                          • Explanation
                                                          • Example
                                                          • Implementations
                                                          • Vere

                                                            • C Runtime System
                                                            • Land of Nouns
                                                            • API overview by prefix
                                                            • C in Urbit
                                                            • Writing Jets
                                                            • Cryptography
                                                            • Azimuth

                                                              • Overview
                                                              • Urbit HD Wallet
                                                              • Azimuth Data Flow
                                                              • Azimuth.eth
                                                              • Ecliptic.eth
                                                              • Advanced Azimuth Tools
                                                              • Life and Rift
                                                              • Layer 2

                                                                • Layer 2 Overview
                                                                • Layer 2 Actions
                                                                • Transaction Format
                                                                • Rollers
                                                                • Roller HTTP RPC-API
                                                                • Custom Roller Tutorial
                                                              • Glossary

                                                                • Ames
                                                                • Aqua
                                                                • Arm
                                                                • Arvo
                                                                • Atom
                                                                • Azimuth
                                                                • Battery
                                                                • Behn
                                                                • Bridge
                                                                • Censures
                                                                • Ceremony
                                                                • chat
                                                                • Claims
                                                                • Clay
                                                                • Comet
                                                                • Core
                                                                • Delegated Sending
                                                                • Desk
                                                                • Dill
                                                                • Document Proposal
                                                                • Dojo
                                                                • Door
                                                                • Ecliptic
                                                                • Event Log
                                                                • Eyre
                                                                • Ford
                                                                • Galaxy
                                                                • Gall
                                                                • Gate
                                                                • HD Wallet
                                                                • Hoon
                                                                • Invite Tree
                                                                • Iris
                                                                • Jael
                                                                • Jaque
                                                                • Keyfile
                                                                • Landscape
                                                                • Mark
                                                                • Moon
                                                                • Nock
                                                                • Noun
                                                                • OTA Updates
                                                                • Payload
                                                                • pH
                                                                • Pier
                                                                • Pill
                                                                • Planet
                                                                • Proxies
                                                                • Replay
                                                                • Factory Reset
                                                                • Naive rollups
                                                                • Sail/Udon
                                                                • Senate
                                                                • Ship
                                                                • ship.arvo.network
                                                                • Star
                                                                • |sync
                                                                • Trap
                                                                • Upgrade Proposal
                                                                • Vane
                                                                • Vere
                                                                • Voting
                                                                • Wallet-Generator
                                                                Urbit
                                                                • Introduction
                                                                • Development

                                                                  • Getting Started
                                                                  • Environment Setup
                                                                  • Grants Program
                                                                  • Project Repositories
                                                                  • Precepts
                                                                  • System Overview

                                                                    • Arvo
                                                                    • Hoon
                                                                    • Nock
                                                                    • Vere
                                                                    • Azimuth
                                                                    • Cryptography
                                                                    • Arvo

                                                                      • Overview
                                                                      • Ames

                                                                        • Overview
                                                                        • Cryptography
                                                                        • API Reference
                                                                        • Scry Reference
                                                                        • Data Types
                                                                        • Behn

                                                                          • Overview
                                                                          • API Reference
                                                                          • Scry Reference
                                                                          • Examples
                                                                          • Clay

                                                                            • Overview
                                                                            • Architecture
                                                                            • Using Clay
                                                                            • Data Types
                                                                            • Scry Reference
                                                                            • API Reference
                                                                            • Examples
                                                                            • Marks

                                                                              • Overview
                                                                              • Writing Marks
                                                                              • Using Marks
                                                                              • Examples
                                                                            • Dill

                                                                              • Overview
                                                                              • API Reference
                                                                              • Scry Reference
                                                                              • Data Types
                                                                              • Eyre

                                                                                • Overview
                                                                                • External API Reference
                                                                                • Internal API Reference
                                                                                • Scry Reference
                                                                                • Data Types
                                                                                • Guide
                                                                                • Ford

                                                                                  • Overview
                                                                                  • Gall

                                                                                    • Overview
                                                                                    • API Reference
                                                                                    • Data Types
                                                                                    • Iris

                                                                                      • Overview
                                                                                      • API Reference
                                                                                      • Data Types
                                                                                      • Example
                                                                                      • Jael

                                                                                        • Overview
                                                                                        • API Reference
                                                                                        • Scry Reference
                                                                                        • Data Types
                                                                                        • Examples
                                                                                        • Concepts

                                                                                          • Scries
                                                                                          • Subscriptions
                                                                                          • Tutorials

                                                                                            • Move Trace
                                                                                            • Reference

                                                                                              • Cryptography
                                                                                              • Filesystem Hierarchy
                                                                                            • Userspace

                                                                                              • Overview
                                                                                              • HTTP API Guide
                                                                                              • Gall Guide

                                                                                                • Introduction
                                                                                                • 1. Arvo
                                                                                                • 2. The Agent Core
                                                                                                • 3. Imports and Aliases
                                                                                                • 4. Lifecycle
                                                                                                • 5. Cards
                                                                                                • 6. Pokes
                                                                                                • 7. Structures and Marks
                                                                                                • 8. Subscriptions
                                                                                                • 9. Vanes
                                                                                                • 10. Scries
                                                                                                • 11. Failure
                                                                                                • 12. Next Steps
                                                                                                • Appendix: Types
                                                                                                • Full-Stack Walkthrough

                                                                                                  • 1. Introduction
                                                                                                  • 2. Types
                                                                                                  • 3. Agent
                                                                                                  • 4. JSON
                                                                                                  • 5. Marks
                                                                                                  • 6. Eyre
                                                                                                  • 7. React app setup
                                                                                                  • 8. React app logic
                                                                                                  • 9. Desk and glob
                                                                                                  • 10. Summary
                                                                                                  • Graph Store

                                                                                                    • Graph Store Overview
                                                                                                    • Data Structure Overview
                                                                                                    • Validator Walkthrough
                                                                                                    • Sample Application: Library
                                                                                                    • Graph Store - Reference
                                                                                                    • Advanced Info
                                                                                                    • Threads

                                                                                                      • Overview
                                                                                                      • HTTP API
                                                                                                      • Reference
                                                                                                      • Basics

                                                                                                        • Fundamentals
                                                                                                        • Bind
                                                                                                        • Input
                                                                                                        • Output
                                                                                                        • Summary
                                                                                                        • Gall

                                                                                                          • Start Thread
                                                                                                          • Take Result
                                                                                                          • Take Facts
                                                                                                          • Stop Thread
                                                                                                          • Poke Thread
                                                                                                          • Examples

                                                                                                            • Fetch JSON
                                                                                                            • Child Thread
                                                                                                            • Main-loop
                                                                                                            • Poke Agent
                                                                                                            • Scry
                                                                                                            • Take Fact
                                                                                                          • Distribution

                                                                                                            • Overview
                                                                                                            • Guide
                                                                                                            • Docket File
                                                                                                            • Glob
                                                                                                            • Dojo Tools
                                                                                                          • Hoon

                                                                                                            • Overview
                                                                                                            • Hoon School

                                                                                                              • 1.1 Introduction
                                                                                                              • 1.1.1 Walkthrough: List of Numbers
                                                                                                              • 1.2 Nouns
                                                                                                              • 1.3 Hoon Syntax
                                                                                                              • 1.3.1 Walkthrough: Conditionals
                                                                                                              • 1.4 Gates (Hoon Functions)
                                                                                                              • 1.4.1 Walkthrough: Recursion
                                                                                                              • 1.5 Lists
                                                                                                              • 1.5.1 Walkthrough: Fibonacci Sequence
                                                                                                              • 1.6 The Subject and Its Legs
                                                                                                              • 1.6.1 Walkthrough: Ackermann Function
                                                                                                              • 1.7 Arms and Cores
                                                                                                              • 1.7.1 Walkthrough: Caesar Cipher
                                                                                                              • 1.8 Doors
                                                                                                              • 1.8.1 Bank Account
                                                                                                              • 1.9 Generators
                                                                                                              • 2.1 Atoms, Auras, and Simple Cell Types
                                                                                                              • 2.2 Type Checking and Type Inference
                                                                                                              • 2.3 Structures and Complex Types
                                                                                                              • 2.3.1 Walkthrough: Libraries
                                                                                                              • 2.3.2 Molds
                                                                                                              • 2.4 Standard Library: Trees, Sets, and Maps
                                                                                                              • 2.5 Type Polymorphism
                                                                                                              • 2.5.1 Walkthrough: Iron Polymorphism and Wet Polymorphism
                                                                                                              • 2.5.2 Walkthrough: Lead Polymorphism
                                                                                                              • 2.6 Behn
                                                                                                              • 2.7 Gall
                                                                                                              • 2.7.1 Gall Walkthrough: Egg Timer
                                                                                                              • Guides

                                                                                                                • CLI apps
                                                                                                                • Parsing
                                                                                                                • JSON
                                                                                                                • Strings
                                                                                                                • Sail (HTML)
                                                                                                                • Writing Aqua Tests
                                                                                                                • Reference

                                                                                                                  • Cheat Sheet
                                                                                                                  • Irregular forms
                                                                                                                  • Hoon Errors
                                                                                                                  • Hoon Style Guide
                                                                                                                  • Basic Types
                                                                                                                  • Advanced Types
                                                                                                                  • Auras
                                                                                                                  • Runes

                                                                                                                    • Atoms and strings
                                                                                                                    • Nock . ('dot')
                                                                                                                    • Wild ! ('zap')
                                                                                                                    • Change Subject = ('tis')
                                                                                                                    • Conditionals ? ('wut')
                                                                                                                    • Cores | ('bar')
                                                                                                                    • Arms + ('lus')
                                                                                                                    • Cells : ('col')
                                                                                                                    • Calls % ('cen')
                                                                                                                    • Casts ^ ('ket')
                                                                                                                    • Structures $ ('buc')
                                                                                                                    • Make ; ('mic')
                                                                                                                    • Hints ~ ('sig')
                                                                                                                    • Imports / ('fas')
                                                                                                                    • Terminators -- and ==
                                                                                                                    • Limbs and wings

                                                                                                                      • Limbs
                                                                                                                      • Wings
                                                                                                                      • Standard library

                                                                                                                        • Table of Contents
                                                                                                                        • 1a: Basic Arithmetic
                                                                                                                        • 1b: Tree Addressing
                                                                                                                        • 1c: Molds and Mold-Builders
                                                                                                                        • 2a: Unit Logic
                                                                                                                        • 2b: List Logic
                                                                                                                        • 2c: Bit Arithmetic
                                                                                                                        • 2d: Bit Logic
                                                                                                                        • 2e: Insecure Hashing
                                                                                                                        • 2f: Noun Ordering
                                                                                                                        • 2g: Unsigned Powers
                                                                                                                        • 2h: Set Logic
                                                                                                                        • 2i: Map Logic
                                                                                                                        • 2j: Jar and Jug Logic
                                                                                                                        • 2k: Queue Logic
                                                                                                                        • 2l: Container from Container
                                                                                                                        • 2m: Container from Noun
                                                                                                                        • 2n: Functional Hacks
                                                                                                                        • 2o: Normalizing Containers
                                                                                                                        • 2p: Serialization
                                                                                                                        • 2q: Molds and Mold-Builders
                                                                                                                        • 3a: Modular and Signed Ints
                                                                                                                        • 3b: Floating Point
                                                                                                                        • 3c: Urbit Time
                                                                                                                        • 3d: SHA Hash Family
                                                                                                                        • 3e: AES encryption (Removed)
                                                                                                                        • 3f: Scrambling
                                                                                                                        • 3g: Molds and Mold-Builders
                                                                                                                        • 4a: Exotic Bases
                                                                                                                        • 4b: Text Processing
                                                                                                                        • 4c: Tank Printer
                                                                                                                        • 4d: Parsing (Tracing)
                                                                                                                        • 4e: Parsing (Combinators)
                                                                                                                        • 4f: Parsing (Rule-Builders)
                                                                                                                        • 4g: Parsing (Outside Caller)
                                                                                                                        • 4h: Parsing (ASCII Glyphs)
                                                                                                                        • 4i: Parsing (Useful Idioms)
                                                                                                                        • 4j: Parsing (Bases and Base Digits)
                                                                                                                        • 4k: Atom Printing
                                                                                                                        • 4l: Atom Parsing
                                                                                                                        • 4m: Formatting Functions
                                                                                                                        • 4n: Virtualization
                                                                                                                        • 4o: Molds
                                                                                                                        • 5a: Compiler Utilities
                                                                                                                        • 5b: Macro Expansion
                                                                                                                        • 5c: Compiler Backend & Prettyprinter
                                                                                                                        • 5d: Parser
                                                                                                                        • 5e: Molds and mold builders
                                                                                                                        • 5f: Profiling support
                                                                                                                        • Zuse

                                                                                                                          • Table of Contents
                                                                                                                          • 2d(1-5): To JSON, Wains
                                                                                                                          • 2d(6): From JSON
                                                                                                                          • 2d(7): From JSON (unit)
                                                                                                                          • 2e(2-3): Print & Parse JSON
                                                                                                                      • Nock

                                                                                                                        • Nock Definition
                                                                                                                        • Explanation
                                                                                                                        • Example
                                                                                                                        • Implementations
                                                                                                                        • Vere

                                                                                                                          • C Runtime System
                                                                                                                          • Land of Nouns
                                                                                                                          • API overview by prefix
                                                                                                                          • C in Urbit
                                                                                                                          • Writing Jets
                                                                                                                          • Cryptography
                                                                                                                          • Azimuth

                                                                                                                            • Overview
                                                                                                                            • Urbit HD Wallet
                                                                                                                            • Azimuth Data Flow
                                                                                                                            • Azimuth.eth
                                                                                                                            • Ecliptic.eth
                                                                                                                            • Advanced Azimuth Tools
                                                                                                                            • Life and Rift
                                                                                                                            • Layer 2

                                                                                                                              • Layer 2 Overview
                                                                                                                              • Layer 2 Actions
                                                                                                                              • Transaction Format
                                                                                                                              • Rollers
                                                                                                                              • Roller HTTP RPC-API
                                                                                                                              • Custom Roller Tutorial
                                                                                                                            • Glossary

                                                                                                                              • Ames
                                                                                                                              • Aqua
                                                                                                                              • Arm
                                                                                                                              • Arvo
                                                                                                                              • Atom
                                                                                                                              • Azimuth
                                                                                                                              • Battery
                                                                                                                              • Behn
                                                                                                                              • Bridge
                                                                                                                              • Censures
                                                                                                                              • Ceremony
                                                                                                                              • chat
                                                                                                                              • Claims
                                                                                                                              • Clay
                                                                                                                              • Comet
                                                                                                                              • Core
                                                                                                                              • Delegated Sending
                                                                                                                              • Desk
                                                                                                                              • Dill
                                                                                                                              • Document Proposal
                                                                                                                              • Dojo
                                                                                                                              • Door
                                                                                                                              • Ecliptic
                                                                                                                              • Event Log
                                                                                                                              • Eyre
                                                                                                                              • Ford
                                                                                                                              • Galaxy
                                                                                                                              • Gall
                                                                                                                              • Gate
                                                                                                                              • HD Wallet
                                                                                                                              • Hoon
                                                                                                                              • Invite Tree
                                                                                                                              • Iris
                                                                                                                              • Jael
                                                                                                                              • Jaque
                                                                                                                              • Keyfile
                                                                                                                              • Landscape
                                                                                                                              • Mark
                                                                                                                              • Moon
                                                                                                                              • Nock
                                                                                                                              • Noun
                                                                                                                              • OTA Updates
                                                                                                                              • Payload
                                                                                                                              • pH
                                                                                                                              • Pier
                                                                                                                              • Pill
                                                                                                                              • Planet
                                                                                                                              • Proxies
                                                                                                                              • Replay
                                                                                                                              • Factory Reset
                                                                                                                              • Naive rollups
                                                                                                                              • Sail/Udon
                                                                                                                              • Senate
                                                                                                                              • Ship
                                                                                                                              • ship.arvo.network
                                                                                                                              • Star
                                                                                                                              • |sync
                                                                                                                              • Trap
                                                                                                                              • Upgrade Proposal
                                                                                                                              • Vane
                                                                                                                              • Vere
                                                                                                                              • Voting
                                                                                                                              • Wallet-Generator
                                                                                                                              Urbit/Documentation/Hoon/Guides

                                                                                                                              Sail (HTML)

                                                                                                                              Sail is a domain-specific language for composing HTML (and XML) structures in Hoon. Like everything else in Hoon, a Sail document is a noun, just one produced by a specialized markup language within Hoon.

                                                                                                                              Front-ends for Urbit apps are often created and uploaded separately to the rest of the code in the desk. Sail provides an alternative approach, where front-ends can be composed directly inside agents.

                                                                                                                              This document will walk through the basics of Sail and its syntax.

                                                                                                                              Basic example

                                                                                                                              It’s easy to see how Sail can directly translate to HTML:

                                                                                                                              SailHTML
                                                                                                                              ;html
                                                                                                                                ;head
                                                                                                                                  ;title: My page
                                                                                                                                  ;meta(charset "utf-8");
                                                                                                                                ==
                                                                                                                                ;body
                                                                                                                                  ;h1: Welcome!
                                                                                                                                  ;p
                                                                                                                                    ; Hello, world!
                                                                                                                                    ; Welcome to my page.
                                                                                                                                    ; Here is an image:
                                                                                                                                    ;br;
                                                                                                                                    ;img@"/foo.png";
                                                                                                                                  ==
                                                                                                                                ==
                                                                                                                              ==
                                                                                                                              
                                                                                                                              <html>
                                                                                                                                <head>
                                                                                                                                  <title>My page</title>
                                                                                                                                  <meta charset="utf-8" />
                                                                                                                                </head>
                                                                                                                                <body>
                                                                                                                                  <h1>Welcome!</h1>
                                                                                                                                  <p>Hello, world! Welcome to my
                                                                                                                                    page. Here is an image:
                                                                                                                                    <br />
                                                                                                                                    <img src="/foo.png" />
                                                                                                                                  </p>
                                                                                                                                </body>
                                                                                                                              </html>
                                                                                                                              

                                                                                                                              Tags and Closing

                                                                                                                              In Sail, tag heads are written with the tag name prepended by ;. Unlike in HTML, there are different ways of closing tags, depending on the needs of the tag. One of the nice things about Hoon is that you don’t have to constantly close expressions; Sail inherits this convenience.

                                                                                                                              Empty

                                                                                                                              Empty tags are closed with a ; following the tag. For example, ;div; will be rendered as <div></div>. Non-container tags ;br; and ;img@"some-url"; in particular will be rendered as a single tag like <br /> and <img src="some-url" />.

                                                                                                                              Filled

                                                                                                                              Filled tags are closed via line-break. To fill text inside, add : after the tag name, then insert your plain text following a space. Example:

                                                                                                                              SailHTML
                                                                                                                              ;h1: The title<h1>The title</h1>

                                                                                                                              Nested

                                                                                                                              To nest tags, simply create a new line. Nested tags need to be closed with ==, because they expect a list of sub-tags.

                                                                                                                              If we nest lines of plain text with no tag, the text will be wrapped in a <p> tag. Additionally, any text with atom auras or ++arm:syntax in such plain text lines will be wrapped in <code> tags.

                                                                                                                              Example:

                                                                                                                              SailHTML
                                                                                                                              ;body
                                                                                                                                ;h1: Blog title
                                                                                                                                This is some good content.
                                                                                                                              ==
                                                                                                                              
                                                                                                                              <body>
                                                                                                                                <h1>Blog title</h1>
                                                                                                                                <p>This is some good content.</p>
                                                                                                                              </body>
                                                                                                                              

                                                                                                                              If we want to write a string with no tag at all, then we can prepend those untagged lines with ; and then a space:

                                                                                                                              SailHTML
                                                                                                                              ;body
                                                                                                                                ;h1: Welcome!
                                                                                                                                ; Hello, world!
                                                                                                                                ; We’re on the web.
                                                                                                                              ==
                                                                                                                              
                                                                                                                              <body>
                                                                                                                                <h1>Welcome!</h1>
                                                                                                                                Hello, world!
                                                                                                                                We’re on the web.
                                                                                                                              </body>
                                                                                                                              

                                                                                                                              Attributes

                                                                                                                              Adding attributes is simple: just add the desired attribute between parentheses, right after the tag name without a space. We separate different attributes of the same node by using ,.

                                                                                                                              Attributes can also be specified in tall form, with each key prefixed by =, followed by two spaces, and then a tape with its value. These two styles are shown below.

                                                                                                                              Generic

                                                                                                                              FormExample
                                                                                                                              Wide
                                                                                                                              ;div(title "a tooltip", style "color:red")
                                                                                                                                ;h1: Foo
                                                                                                                                foo bar baz
                                                                                                                              ==
                                                                                                                              
                                                                                                                              Tall
                                                                                                                              ;div
                                                                                                                                =title  "a tooltip"
                                                                                                                                =style  "color:red"
                                                                                                                                ;h1: Foo
                                                                                                                                foo bar baz
                                                                                                                              ==
                                                                                                                              
                                                                                                                              HTML
                                                                                                                              <div title="a tooltip" style="color:red">
                                                                                                                                <h1>Foo</h1>
                                                                                                                                <p>foo bar baz </p>
                                                                                                                              </div>
                                                                                                                              

                                                                                                                              IDs

                                                                                                                              Add # after tag name to add an ID:

                                                                                                                              SailHTML
                                                                                                                              ;nav#header: Menu<nav id="header">Menu</nav>

                                                                                                                              Classes

                                                                                                                              Add . after tag name to add a class:

                                                                                                                              SailHTML
                                                                                                                              ;h1.text-blue: Title<h1 class="text-blue">Title</h1>

                                                                                                                              For class values containing spaces, you can add additional .s like so:

                                                                                                                              SailHTML
                                                                                                                              ;div.foo.bar.baz;<div class="foo bar baz"></div>

                                                                                                                              Otherwise, if your class value does not conform to the allowed @tas characters, you must use the generic attribute syntax:

                                                                                                                              SailHTML
                                                                                                                              ;div(class "!!! !!!");<div class="!!! !!!"></div>

                                                                                                                              Images

                                                                                                                              Add @ after the tag name to link your source:

                                                                                                                              SailHTML
                                                                                                                              ;img@"example.png";<img src="example.png"/>

                                                                                                                              To add attributes to the image, like size specifications, add the desired attribute after the " of the image name and before the final ; of the img tag like ;img@"example.png"(width "100%");`.

                                                                                                                              Links

                                                                                                                              Add / after tag name to start an href.

                                                                                                                              Sail
                                                                                                                              ;a/"urbit.org": A link to Urbit.org
                                                                                                                              
                                                                                                                              HTML
                                                                                                                              <a href="urbit.org">A link to Urbit.org</a>
                                                                                                                              

                                                                                                                              Interpolation

                                                                                                                              The textual content of tags, despite not being enclosed in double-quotes, are actually tapes. This means they support interpolated Hoon expressions in the usual manner. For example:

                                                                                                                              SailHTML
                                                                                                                              =|  =time
                                                                                                                              ;p: foo {<time>} bar
                                                                                                                              
                                                                                                                              <p>foo ~2000.1.1 baz</p>
                                                                                                                              

                                                                                                                              Likewise:

                                                                                                                              Sail
                                                                                                                              =/  txt=tape  " bananas"
                                                                                                                              ;article
                                                                                                                                ;b: {(a-co:co (mul 42 789))}
                                                                                                                                ; {txt}
                                                                                                                                {<our>} {<now>} {<`@ux`(end 6 eny)>}
                                                                                                                              ==
                                                                                                                              
                                                                                                                              HTML
                                                                                                                              <article>
                                                                                                                                <b>33138</b> bananas
                                                                                                                                <p>~zod ~2022.2.21..09.54.21..5b63 0x9827.99c7.06f4.8ef9</p>
                                                                                                                              </article>
                                                                                                                              

                                                                                                                              A note on CSS

                                                                                                                              The CSS for a page is usually quite large. The typical approach is to include a separate arm in your agent (++style or the like) and write out the CSS in a fenced cord block. You can then call ++trip on it and include it in a style tag. For example:

                                                                                                                              ++  style
                                                                                                                                ^~
                                                                                                                                %-  trip
                                                                                                                                '''
                                                                                                                                main {
                                                                                                                                  width: 100%;
                                                                                                                                  color: red;
                                                                                                                                }
                                                                                                                                header {
                                                                                                                                  color: blue;
                                                                                                                                  font-family: monospace;
                                                                                                                                }
                                                                                                                                '''
                                                                                                                              

                                                                                                                              And then your style tag might look like:

                                                                                                                              ;style: {style}
                                                                                                                              

                                                                                                                              A cord is used rather than a tape so you don't need to escape braces. The ketsig (^~) rune means ++trip will be run at compile time rather than call time.

                                                                                                                              Types and marks

                                                                                                                              So far we've shown rendered HTML for demonstrative purposes, but Sail syntax doesn't directly produce HTML text. Instead, it produces a $manx. This is a Hoon type used to represent an XML hierarchical structure with a single root node. There are six XML-related types defined in the standard library:

                                                                                                                              +$  mane  $@(@tas [@tas @tas])                    ::  XML name+space
                                                                                                                              +$  manx  $~([[%$ ~] ~] [g=marx c=marl])          ::  dynamic XML node
                                                                                                                              +$  marl  (list manx)                             ::  XML node list
                                                                                                                              +$  mars  [t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~]  ::  XML cdata
                                                                                                                              +$  mart  (list [n=mane v=tape])                  ::  XML attributes
                                                                                                                              +$  marx  $~([%$ ~] [n=mane a=mart])              ::  dynamic XML tag
                                                                                                                              

                                                                                                                              More information about these can be found in section 5e of the standard library reference.

                                                                                                                              You don't need to understand these types in order to write Sail. The main thing to note is that a $manx is a node (a single tag) and its contents is a $marl, which is just a (list manx).

                                                                                                                              Rendering

                                                                                                                              A $manx can be rendered as HTML in a tape with the ++en-xml:html function in zuse.hoon. For example:

                                                                                                                              > ;p: foobar
                                                                                                                              [[%p ~] [[%$ [%$ "foobar"] ~] ~] ~]
                                                                                                                              
                                                                                                                              > =x ;p: foobar
                                                                                                                              
                                                                                                                              > (en-xml:html x)
                                                                                                                              "<p>foobar</p>"
                                                                                                                              
                                                                                                                              > (crip (en-xml:html x))
                                                                                                                              '<p>foobar</p>'

                                                                                                                              Sanitization

                                                                                                                              The ++en-xml:html function will sanitize the contents of both attributes and elements, converting characters such as > to HTML entities. For example:

                                                                                                                              > =z ;p(class "\"><script src=\"example.com/xxx.js"): <h1>FOO</h1>
                                                                                                                              
                                                                                                                              > (crip (en-xml:html z))
                                                                                                                              '<p class="&quot;&gt;&lt;script src=&quot;example.com/xxx.js">&lt;h1&gt;FOO&lt;/h1&gt;</p>'

                                                                                                                              Marks

                                                                                                                              There are a few different HTML and XML related marks, so it can be a bit confusing. We'll look at the ones you're most likely to use.

                                                                                                                              %html

                                                                                                                              • Type: @t

                                                                                                                              This mark is used for HTML that has been printed as text in a cord. You may wish to return this mark when serving pages to the web. To do so, you must run the $manx produced by your Sail expressions through ++en-xml:html, and then run the resulting tape through ++crip.

                                                                                                                              %hymn

                                                                                                                              • Type: $manx

                                                                                                                              The %hymn mark is intended to be used for complete HTML documents - having an <html> root element, <head>, <body>, etc. This isn't enforced on the type level but it is assumed in certain mark conversion pathways. Eyre can automatically convert a %hymn to printed %html if it was requested through Eyre's scry interface.

                                                                                                                              %elem

                                                                                                                              • Type: $manx

                                                                                                                              The type of the %elem mark is a $manx, just like a %hymn. While %hymns are intended for complete HTML documents, %elems are intended for more general XML structures. You may wish to use an %elem mark if you're producing smaller fragments of XML or HTML rather than whole documents. Like a %hymn, Eyre can automatically convert it to %html if requested through its scry interface.

                                                                                                                              Summary

                                                                                                                              In general, if you're going to be composing web pages and serving them to web clients, running the result of your Sail through ++en-xml:html, ++cripping it and producing %html is the most straight-forward approach. If you might want to pass around a $manx to other agents or ships which may wish to manipulate it futher, a %hymn or %elem is better.

                                                                                                                              Sail Runes

                                                                                                                              In addition to the syntax so far described, there are also a few Sail-specific runes:

                                                                                                                              ;+ Miclus

                                                                                                                              The miclus rune makes a $marl from a complex hoon expression that produces a single $manx. Its main use is nesting tall-form hoon logic in another Sail element. For example:

                                                                                                                              ;p
                                                                                                                                ;b: {(a-co:co number)}
                                                                                                                                ; is an
                                                                                                                                ;+  ?:  =(0 (mod number 2))
                                                                                                                                      ;b: even
                                                                                                                                    ;b: odd
                                                                                                                                ; number.
                                                                                                                              ==
                                                                                                                              

                                                                                                                              Produces one of these depending on the value of number:

                                                                                                                              <p><b>2 </b>is an <b>even </b>number.</p>
                                                                                                                              <p><b>12345 </b>is an <b>odd </b>number.</p>

                                                                                                                              ;* Mictar

                                                                                                                              The mictar rune makes a $marl (a list of XML nodes) from a complex hoon expression. This rune lets you add many elements inside another Sail element. For example:

                                                                                                                              SailHTML
                                                                                                                              =/  nums=(list @ud)  (gulf 1 9)
                                                                                                                              ;p
                                                                                                                                ;*  %+  turn  nums
                                                                                                                                    |=  n=@ud
                                                                                                                                    ?:  =(0 (mod n 2))
                                                                                                                                      ;sup: {(a-co:co n)}
                                                                                                                                    ;sub: {(a-co:co n)}
                                                                                                                              ==
                                                                                                                              
                                                                                                                              <p>
                                                                                                                                <sub>1</sub><sup>2</sup>
                                                                                                                                <sub>3</sub><sup>4</sup>
                                                                                                                                <sub>5</sub><sup>6</sup>
                                                                                                                                <sub>7</sub><sup>8</sup>
                                                                                                                                <sub>9</sub>
                                                                                                                              </p>
                                                                                                                              

                                                                                                                              ;= Mictis

                                                                                                                              The mictis rune makes a $marl (a list of XML nodes) from a series of $manxes. This is mostly useful if you want to make the list outside of an element and then be able to insert it afterwards. For example:

                                                                                                                              SailHTML
                                                                                                                              =/  paras=marl
                                                                                                                                ;=  ;p: First node.
                                                                                                                                    ;p: Second node.
                                                                                                                                    ;p: Third node.
                                                                                                                                ==
                                                                                                                              ;main
                                                                                                                                ;*  paras
                                                                                                                              ==
                                                                                                                              
                                                                                                                              <main>
                                                                                                                                <p>First node.</p>
                                                                                                                                <p>Second node.</p>
                                                                                                                                <p>Third node.</p>
                                                                                                                              </main>
                                                                                                                              

                                                                                                                              ;/ Micfas

                                                                                                                              The micfas rune turns an ordinary tape into a $manx. For example:

                                                                                                                              > %-  en-xml:html  ;/  "foobar"
                                                                                                                              "foobar"

                                                                                                                              In order to nest it inside another Sail element, it must be preceeded with a ;+ rune or similar, it cannot be used directly. For example:

                                                                                                                              ;p
                                                                                                                                ;+  ;/  ?:  =(0 (mod eny 2))
                                                                                                                                          "even"
                                                                                                                                        "odd"
                                                                                                                              ==
                                                                                                                              

                                                                                                                              Good examples

                                                                                                                              Here's a couple of agents that make use of Sail, which you can use as a reference:

                                                                                                                              • Pals by ~palfun-foslup
                                                                                                                              • Gora by ~rabsef-bicrym

                                                                                                                              <-

                                                                                                                              JSON

                                                                                                                              Writing Aqua Tests

                                                                                                                              ->

                                                                                                                              Edit this page on GitHub