Code-fence formats

YANG renders as a tree

A yang fence is parsed at build time by remarkLfmCodeFences and the yang handler, then rendered as the RFC 8340 tree diagram — YANG's canonical visual form. No dependencies: the RFC 7950 grammar is regular enough to tokenize by hand.

module
lossless-fleet
namespace
urn:lossless:params:xml:ns:yang:lossless-fleet
prefix
flt
revision
2026-08-08

Rendered tree

module: lossless-fleet
  +--rw fleet
  |  +--rw name   string
  |  +--rw tag*   string
  |  +--rw registry!
  |  |  +--rw endpoint?   string
  |  +--rw site* [slug]
  |     +--rw slug           string
  |     +--rw title?         string
  |     +--rw created-at     string
  |     +--rw modified-at?   string
  |     +--rw hosting?
  |     |  +--rw vercel
  |     |  |  +--rw project-id?   string
  |     |  +--rw self-hosted
  |     |     +--rw host?   string
  |     |     +--rw port?   uint16
  |     +--ro build-state
  |        +--ro last-status?     enumeration
  |        +--ro last-duration?   uint32
  +--x rebuild-site
  |  +--w input
  |  |  +--w slug     string
  |  |  +--w force?   boolean
  |  +--ro output
  |     +--ro job-id?   string
  +--n build-finished
     +--ro slug?   string
     +--ro ok?     boolean

rw config · ro state · x rpc · n notification · ? optional · * multiple · ! presence · [key] list key

Source

module lossless-fleet {
  yang-version 1.1;
  namespace "urn:lossless:params:xml:ns:yang:lossless-fleet";
  prefix "flt";

  organization "The Lossless Group";
  description
    "Model for the Astro Knots site fleet: which sites exist, "
    + "what they publish, and their build state.";

  revision 2026-08-08 {
    description "Initial revision.";
  }

  grouping timestamps {
    leaf created-at {
      type string;   // ISO-8601
      mandatory true;
    }
    leaf modified-at {
      type string;
    }
  }

  container fleet {
    leaf name {
      type string;
      mandatory true;
    }

    leaf-list tag {
      type string;
    }

    container registry {
      presence "Registry is configured";
      leaf endpoint { type string; }
    }

    list site {
      key "slug";

      leaf slug  { type string; mandatory true; }
      leaf title { type string; }

      uses timestamps;

      choice hosting {
        case vercel {
          leaf project-id { type string; }
        }
        case self-hosted {
          leaf host { type string; }
          leaf port { type uint16; }
        }
      }

      container build-state {
        config false;
        leaf last-status   { type enumeration; }
        leaf last-duration { type uint32; }
      }
    }
  }

  rpc rebuild-site {
    input {
      leaf slug  { type string; mandatory true; }
      leaf force { type boolean; }
    }
    output {
      leaf job-id { type string; }
    }
  }

  notification build-finished {
    leaf slug { type string; }
    leaf ok   { type boolean; }
  }
}