disco://docs/disco-xml-spec, so an agent and a person always work from one specification.
Disco XML is the format the Disco API and MCP Connector use for rich content: lesson bodies,
descriptions, and any other field authored in the Disco editor. When you read content you
receive Disco XML. When you create or update content you send Disco XML.
The format is a small, strict XML vocabulary. It is deliberately close to HTML for ordinary
prose, with Disco-specific elements only where HTML has no name for something.
Three things to know before anything else:
- It is strict. Anything not in this document is rejected with an error that says where the problem is and, where possible, what you probably meant. Nothing is silently dropped or guessed.
- It round-trips. Any content you can create in the Disco editor can be read as Disco XML and written back without loss.
- Output is deterministic. Reading the same content always produces the same text, so you can diff it and make find-and-replace edits safely.
Document structure
Every document is onedisco_doc element.
You may start the document with an XML declaration or a bare <!DOCTYPE disco_doc>; both are
ignored, and Disco never writes them. A DOCTYPE that declares entities or points at an external
DTD is rejected, as is any processing instruction. Comments are ignored.
Content is a sequence of blocks. Most blocks hold rich text: ordinary text plus inline
elements such as links and line breaks. Some blocks hold structure instead, such as a list’s items, and a
few, such as a divider, hold nothing. No block holds both, so <p><p>x</p></p> is an error,
and an inline element never appears directly under the root or inside a block that holds
blocks. Every element belongs to one category, which fixes where it may appear and what it may
contain:
disco_doc
The root of every document. Contains blocks.
No attributes.
- An empty document is
<disco_doc/>.<disco_doc><p/></disco_doc>means the same thing.
Naming
- Element names are lowercase and case-sensitive. HTML names are used where HTML has the same concept and Disco-specific names where it does not.
- Attribute names are
snake_case. Values of enumerated attributes are lowercase. - There are no aliases. Each element and attribute has exactly one spelling. Familiar
alternatives such as
paragraph,strong,em, andspanare rejected, and the error names the Disco XML spelling to use instead. - HTML styling attributes are never accepted.
style,class,id, anddata-*are rejected on every element. Presentation comes only from the elements and attributes in this document.
Whitespace
In this section, whitespace means spaces, tabs, and newlines. Other Unicode spaces, such as a non-breaking space, are ordinary text. Between blocks, whitespace is ignored. Indent your document however you like. Disco indents two spaces per level when it produces XML. Inside a block, text is preserved exactly as written, with two exceptions that let you wrap long paragraphs across lines in your source:- A run of whitespace that contains a newline is collapsed to a single space.
- Such a run is removed instead at the very start or very end of a block, on either side of
a
<br/>, and between a list item’s text and its nested list, so tags can sit on their own lines.
<p>A long paragraph can be wrapped across lines.<br/>Second line.</p>,
which is how Disco writes it back.
Everything else is significant: a single space and a double space between two words are
different content. Disco writes each block’s text on a single line.
A line break inside a block is <br/>; a newline in your source never becomes one. A tab
is <tab/>. A literal tab character is kept as a tab unless it sits in a whitespace run that
contains a newline, where it collapses with the run, so write <tab/> for a tab you mean as
content.
Inside a code block, none of this applies: every space, tab, and newline is content, apart
from the newlines that put the tags on lines of their own. See codeblock.
Escaping
Only these need escaping:
Everything else, including
>, /, quotes in text, backticks, and braces, is written as is.
Numeric character references such as 	 are accepted. The only named entities are XML’s
own five, <, >, &, ", and ', so is an error. A bare
&, a < that does not begin a tag, and control characters are errors too, each with a
message saying what to write instead.
If you are pasting text with many < or & characters, you may wrap it in a CDATA section:
everything between <![CDATA[ and ]]> is taken literally, so the text itself cannot contain
]]>. Disco accepts CDATA anywhere text is allowed and never writes it; content you read back
always uses <, &, and ]]>.
Attributes
Every attribute in this document is one of three kinds:
Any attribute not listed for an element is an error.
Identifiers
Some elements point at a record in your academy: a mention or an attach block names a product, event, content item, or pathway, depending on itskind. They name it by id, in the
attribute that says which kind of id it is: product_id, occurrence_id, instance_id, or
pathway_id. Each id is exactly what the API returns for
that record, so you can copy it from a response. Writing an id attribute the element takes,
but not for this kind, is id_mismatch, and the error names the right one; an id attribute
the element never takes is unknown_attribute, like any other attribute not listed for it.
An id that does not exist or belongs to another academy is unresolved_reference.
When you read, each reference carries its record’s name beside the id, in a read-only
attribute named the same way: product_name, occurrence_name, content_title, or
pathway_name. A reference whose record was not found carries
not_found="true" instead, with whatever is still known of it; a mention copied from another
academy may be left with the marker alone. You may leave these attributes out when you write,
or copy them back unchanged; they are ignored.
Text blocks
Blocks that hold rich text directly. All of them takealign and indent; a quote or callout
is indented as a whole, since there is no paragraph inside it to indent.
p
A paragraph. Contains rich text.
- An empty paragraph is
<p/>.
h1
A level 1 heading. Contains rich text.
h2
A level 2 heading. Contains rich text.
h3
A level 3 heading. Contains rich text.
blockquote
A quotation. Contains rich text.
- Holds text directly; there is no paragraph inside it. Use
<br/>for more than one line.
callout
A highlighted box that draws attention to its text. Contains rich text.
- Holds text directly; there is no paragraph inside it. Use
<br/>for more than one line.
Lists
A list holds items and nothing else, and each item’s text sits directly in itsli. Lists
nest as they do in HTML: the nested list is the last child of the item it belongs under, after
that item’s text. The nested list may open on the item’s line or on a line of its own; see
Whitespace.
ul
A bulleted list. Contains one or more li.
No attributes.
ol
A numbered list. Contains one or more li.
checklist
A list of items with checkboxes. Contains one or more li.
No attributes.
- Each item’s state is its
checkedattribute.
li
An item in a list. Contains rich text, optionally followed by one ul, ol, or checklist.
- Holds text, optionally followed by one nested
ul,ol, orchecklistas its last child. An item may hold only a nested list, as<li><ul>…</ul></li>. - Lists nest at most six levels deep, counting the outermost list as one, and a document holds at most 500 items across all its lists.
checkedis accepted only insidechecklist, andchecked="true"only on an item with text: an item holding nothing but a nested list has no checkbox.- An empty item is
<li/>.
Tables
A table holds rows, a row holds cells, and a cell holds blocks: paragraphs, headings, lists, code, or anything else that may sit directly in the document, except another table. A header cell is ath and any other cell a td, side by side in the same row as in HTML. The cells
form a grid. A cell may cover several columns or rows with colspan and rowspan, and the
cells it covers are left out, so every row covers the same number of columns once the spans
are counted.
table
A table of rows and cells. Contains one or more tr.
No attributes.
- A table cannot hold another table. Content created before that rule may still hold one, and Disco reads it out as written; it cannot be written back until the inner table is moved out of its cell in the editor.
- Pasted content can hold rows that do not form a grid. Disco reads such a table out as written, and it cannot be written back until every row covers the same number of columns.
tr
A row of cells in a table. Contains one or more td or th.
No attributes.
- Every row covers the same number of columns once
colspanandrowspanare counted.
td
A cell in a table row. Contains blocks.
- Never holds bare text: write
<td><p>Hello</p></td>, not<td>Hello</td>. Any block that may sit directly in the document may sit in a cell, except a table. - An empty cell is
<td/>.<td><p/></td>means the same thing. - A cell that covers several columns or rows carries
colspanorrowspan, and the cells it covers are not written. - Resizing a column in the editor sets
widthon every cell in that column, so a column’s width is written on each of its cells.
th
A header cell in a table row. Contains blocks.
- Holds blocks and takes
colspan,rowspan, andwidthexactly astddoes. - A header row is every cell in that row written as
th; a row may mixthandtd, as a row whose first cell is a heading does.
Dividers
hr
A horizontal rule between blocks. Holds nothing and is written self-closing.
No attributes.
Embeds
Content from another service, in one of four elements:embed, for a service that is embedded by its URL, with the service as itskind.embed_html, for a service that hands out an iframe snippet, or for any other HTML.pdf, for a PDF from the media library.scorm, for a SCORM package the document already holds. It cannot be added.
height in pixels. A youtube, loom, vimeo, or
wistia block ignores it, since it sizes itself to its width.
embed
Third-party content shown by its URL. Holds nothing and is written self-closing.
- Services embedded from an iframe snippet rather than a URL are written with
embed_html; a PDF withpdf. - A YouTube URL stored without its scheme reads back as stored; add
https://before writing it. - A QR code holding anything other than a URL reads back but cannot be written.
- Each kind accepts only its own service’s URLs. Any other URL is an error that says what the kind expects. Write each kind as below, which is what the editor asks for; a URL in another form can be accepted and still not display.
airtable: the share link of a view or base, onhttps://airtable.comwith a/shr…id, such ashttps://airtable.com/appA1b2C3d4E5f6G7/shrH8i9J0k1L2m3N4.calendly: the event’shttps://link, as Copy Link gives it in Calendly, such ashttps://calendly.com/disco/intro-call.figma: thehttps://URL of afile,design, orproto, from the browser’s address bar, such ashttps://www.figma.com/design/AbCdEfGhIjKlMnOpQrStUv/Course-map. It must be shared so that anyone with the link can view it.google_docs: the document’s URL from the browser’s address bar, ending in/edit, such ashttps://docs.google.com/document/d/1AbCdEfGhIjKlMnOpQrStUv/edit. It must be shared so that anyone with the link can view it.google_forms: the form’s URL from the browser’s address bar, ending in/edit, such ashttps://docs.google.com/forms/d/1AbCdEfGhIjKlMnOpQrStUv/edit. Its public/viewformlink also works.google_sheets: the spreadsheet’s URL from the browser’s address bar, ending in/edit, such ashttps://docs.google.com/spreadsheets/d/1AbCdEfGhIjKlMnOpQrStUv/edit. It must be shared so that anyone with the link can view it.google_slides: the presentation’s URL from the browser’s address bar, ending in/edit, such ashttps://docs.google.com/presentation/d/1AbCdEfGhIjKlMnOpQrStUv/edit. It must be shared so that anyone with the link can view it.loom: the video’sloom.com/share/link, or itsloom.com/embed/link, such ashttps://www.loom.com/share/0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d.typeform: the form’shttps://share link, on the account’s owntypeform.comsubdomain, such ashttps://disco.typeform.com/to/AbC123.vimeo: the video’svimeo.comlink, holding its number, such ashttps://vimeo.com/76979871.youtube: the video’s watch, share (youtu.be), or embed link, holding its 11-character id, such ashttps://www.youtube.com/watch?v=dQw4w9WgXcQ.qr_code: any URL, which is shown as a QR code and not embedded, such ashttps://disco.co/join.
embed_html
Third-party content shown from an HTML snippet. Contains text, exactly as written.
- The content is the HTML itself, and every character inside is kept as written apart from the edges, as in
codeblock. - It is easiest to write in CDATA,
<embed_html><![CDATA[<iframe src="…"></iframe>]]></embed_html>. Disco writes it back escaped, as in the example. - Disco keeps common text and layout elements (
div,p,a,tableand the like) andiframe, with their attributes. Any other element,script,style, andimgincluded, is not run or drawn: its tag is stored as visible text. So an embed that needs a script does not work, and what you read back can differ from what you wrote. - A kind other than
embed_codemust contain aniframeelement with asrc. - The HTML may be at most 65536 characters, both as you write it and as Disco stores it.
pdf
A PDF from the media library, shown in a viewer. Holds nothing and is written self-closing.
- The asset must be a PDF. Any other file is
unresolved_reference, with a message naming its type. - An older PDF whose file is not in the media library is read back by
url, with noasset_id. It can be left in place or removed, but not written: a new or movedpdfneeds anasset_id. - A document holds at most 100
pdfelements.
scorm
A SCORM package, played in place. Holds nothing and is written self-closing.
- A SCORM block can be moved or removed, but not added: every
scormyou write must be one the document you are editing already holds, each used once. Anything else isforbidden_in_context, as is anyscormin a document you create. - The block comes back as it was stored, so nothing about it can be changed.
Attach blocks
An attach block is a card linking to something else in the academy. It holds nothing; the card is drawn from the record it points at.attach
A card linking to a content item, event, course, or pathway. Holds nothing and is written self-closing.
- The id must belong to this academy.
kind="product"attaches a course. A pathway is attached withkind="pathway"and its own id.- An attach block is read back with its record’s name beside the id, or marked
not_found="true"when the record was not found.
Inline formatting
Marks wrap rich text and change how it looks. They may nest in any order, so<b><i>x</i></b>
and <i><b>x</b></i> are the same content; the one exception is that sub and sup may not
both apply to the same text.
Formatting belongs to text, and a line break is not text, so a <br/> carries no marks.
You may write <i>one<br/>two</i>, and Disco reads it as, and writes it back as,
<i>one</i><br/><i>two</i>. A <tab/> is text, so it keeps the marks it sits inside:
<u>a<tab/>b</u> underlines the tab and is different content from <u>a</u><tab/><u>b</u>.
b
Bold text. Contains rich text.
i
Italic text. Contains rich text.
u
Underlined text. Contains rich text.
s
Strikethrough text. Contains rich text.
code
Inline code. Contains rich text.
sub
Subscript text. Contains rich text.
sup
Superscript text. Contains rich text.
mark
Coloured text, a coloured background, or both. Contains rich text.
- At least one of
colorandbackgroundis required; a bare<mark/>is an error. - Short hex such as
#fb0or#fb08is accepted and read back with each digit doubled. - Eight-digit hex such as
#d12f2f80carries transparency and is kept; a fully opaque#d12f2fffreads back as six digits. - A nested
markreplaces only the colours it names, so an innercolorkeeps an outerbackground.
Links
A link wraps rich text the way a mark does, with one difference: it is always the outermost wrapper. You may write marks around a link or inside it, and Disco reads both the same way; it writes them inside.link
A hyperlink. Contains rich text.
- Holds text and marks; a link cannot hold another link, and a link with nothing inside it is an error.
- A link is always the outermost wrapper. Marks may be written around it, so
<b>Read <link url="https://disco.co">this</link></b>is accepted, and Disco reads it as and writes it back as<b>Read </b><link url="https://disco.co"><b>this</b></link>. - A
<br/>inside a link stays inside it, so a link may span lines. - Two links to the same URL side by side stay two links.
- Content created outside the editor’s link dialog can hold a URL without an accepted scheme, such as a relative path. Disco still writes it as stored, and rejects the document until the URL is corrected.
Mentions
A mention sits inside rich text like a link, but holds nothing: the name shown comes from the record it points at. It belongs directly in its block, outside every mark and link.mention
A mention of a product, event, or content item. Holds nothing and is written self-closing.
- A mention sits directly in its block: not inside a mark, and not inside a link.
- The id must belong to this academy.
- A mention is read back with its record’s name beside the id. One whose record was not found is marked
not_found="true"instead, and a mention cloned from another academy has lost its record and is read back with nothing but the marker.
Code blocks
codeblock
A block of source code, shown in a monospaced font. Contains text, exactly as written.
- Every space, tab, and newline inside is content, and no elements are allowed: write a line break as a newline and a tab as a tab character. Only
<and&need escaping, and CDATA is accepted. - One newline right after the opening tag, and one newline plus any spaces or tabs right before the closing tag, are not content, so the tags can sit on their own lines.
Line breaks and tabs
Empty inline elements that may appear anywhere in a block’s text.br
A line break inside a block. Holds nothing and is written self-closing.
No attributes.
- A newline in your source is not a line break; see Whitespace.
tab
A tab inside a block. Holds nothing and is written self-closing.
No attributes.
- A literal tab character is also accepted; see Whitespace.
Validation
Writing is all-or-nothing. If any part of a document is invalid, nothing is saved and you receive a list of at most 100 errors. Each error carries:code, one of the codes below, andmessage, a sentence saying what to write instead.lineandcolumnin your XML, when the error has a position.path, the element at fault such asdisco_doc/p[2].attribute, the attribute at fault, when there is one.allowed, the accepted values, when they are a fixed set.suggestion, the name you probably meant, when there is a likely one.
How Disco writes XML
When you read content, Disco always writes the XML the same way. This is the form you read back, not a form you must write: Disco accepts any layout and attribute order this document allows, and one fixed form on the way out is what lets you diff a read and copy anold_str
from it that matches.
- No XML declaration, DOCTYPE, or comments. The root is
disco_doc. - One block per line, indented two spaces per level. Text within a block on a single line.
- A nested list opens on the line of the item that holds it, right after the item’s text, and
its items are indented under that line; its closing tag and the item’s share a line:
<li>Fruit<ul>, the nested items, then</ul></li>. - A code block’s text between its tags on lines of its own, never indented.
- Attributes in the order listed in this document. Optional attributes omitted when they hold the default.
- Empty elements written self-closing:
<p/>,<br/>,<hr/>. - Marks nested in a fixed order, outermost to innermost —
mark,b,i,u,s,sub,sup,code— using the fewest wrappers that order allows. Alinkis outside every mark, so marks are closed before a link opens and reopened inside it. Colours as lowercase hex, six digits when opaque and eight when not.
Editing
Where Disco accepts edits, an edit finds some text in the content and replaces it. It works on the XML you get when you read the content. Each edit has the text to find, the text to put in its place, and an optional flag to replace every match:- Copy
old_strexactly. Take it from the XML you read, with every space, line break, and escape such as&for&. Text typed again by hand may not match. old_strmust match exactly once. If it matches nothing, the edit fails. If it matches more than once, the edit fails and the error says where each match is. Add more of the text around it so it matches once, or setreplace_allto change every match.old_strcan match markup as well as text. Areplace_allforcenteralso changesalign="center". Include the surrounding tags to change only the text.- Edits sent together are applied together. Each one is matched against the content as you read it, not as another edit left it. Two edits that change the same text are an error.
- Read-only attributes need not match. A record’s name and
not_foundare removed from the content and from yourold_strbefore matching, so a record renamed or removed after you read does not break an edit. - References you do not touch are kept as they are. A mention or attach block outside
every
old_strstays exactly as stored, even when it is markednot_found, so a record removed since the content was written does not block an edit elsewhere. One insidenew_stris checked like any other. new_strcan be written in any layout this document allows. Disco checks the whole edited content, as it does when you write a full document, and saves nothing if it is invalid. What is saved is rewritten in the form under “How Disco writes XML”, so read the content again before copying your nextold_str.
code and a message. Most also have
edit, the position of the failing edit in the list, counting from zero.
For
invalid_result, the line and column in error count from the start of one of two
texts, and relative_to says which:
new_strwhen the problem is inside the text the edit added.documentwhen it is elsewhere, such as a tag the edit left unclosed. The position is in the content as you read it.