IDML Reference / Stories & text
Story structure
How an IDML story is built — style runs (ParagraphStyleRange, CharacterStyleRange), Content, and the characters that end paragraphs, break lines and tab.
Reviewed against engine v0.71.6
A story is a sequence of style runs: ParagraphStyleRange → CharacterStyleRange → Content, with paragraphs ended by an in-band <Br/> mark.
In short A Story holds ParagraphStyleRange elements. Each is a style run: a
stretch of text that shares one set of paragraph attributes, which may cover several
paragraphs. Inside it, each CharacterStyleRange is a stretch that shares one set of
character attributes, and the characters themselves sit in Content. Paragraphs are not
elements at all. A paragraph ends where a <Br/> mark stands; a forced line break is the
character U+2028 inside Content; a tab is the tab character U+0009. This page is the
reference for that model.
Story
└── ParagraphStyleRange a run of paragraphs sharing paragraph attributes
└── CharacterStyleRange a run of characters sharing character attributes
├── Content literal text (may contain U+2028 and U+0009)
└── Br the paragraph mark: ends a paragraphParagraphs are marked, not wrapped
The ranges are flat and never overlap. A new ParagraphStyleRange starts only where a
paragraph attribute changes: a different style, or a local override such as
SpaceBefore. A new CharacterStyleRange starts only where a character attribute
changes. Where the paragraphs end is said by the text itself: every paragraph except the
story's last ends with a <Br/>.
So the number of ParagraphStyleRange elements is the number of style runs, not the
number of paragraphs. A story of ten paragraphs in one style is one range with nine
marks. A heading followed by body text is two ranges, and the heading still ends with a
<Br/> inside the first. The paragraph model
explains why.
Three paragraphs in two style runs: two <Br/> marks, one forced line break, and a new
range where the third paragraph's attributes change.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging" DOMVersion="20.0">
<Story Self="ustory">
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]">
<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]">
<Content>A first paragraph.</Content>
<Br/>
<Content>A second one, with a forced
line break inside it.</Content>
<Br/>
</CharacterStyleRange>
</ParagraphStyleRange>
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]" SpaceBefore="12">
<CharacterStyleRange AppliedCharacterStyle="CharacterStyle/$ID/[No character style]">
<Content>A third paragraph, set apart by its own SpaceBefore.</Content>
</CharacterStyleRange>
</ParagraphStyleRange>
</Story>
</idPkg:Story>
The characters that shape the text
| In the XML | Character | Effect |
|---|---|---|
<Br/> | paragraph mark | Ends the paragraph. Omitted after the story's last paragraph. |
U+2028 in Content | forced line break | Breaks the line; the paragraph continues (no new first-line indent, no space before). |
U+0009 in Content | tab | Moves the text after it to the next tab stop of the paragraph's TabList. |
<?ACE 18?> in Content | page number | The current page number, or the next/previous one when the range carries PageNumberType. |
<?ACE 19?> in Content | section marker | The name of the section the page belongs to. |
A tab has no element of its own: the character is part of the text, usually written as
	 or as a literal tab. Tab stops are a separate thing, records in the paragraph's
TabList (see drop caps and tabs). U+2029
(paragraph separator) is not how InDesign writes anything; a reader treats it as the
paragraph break it names. Page numbers and section markers are covered on
text variables.
Story
The root element of a Stories/Story_*.xml part. Its Self id is what a text frame
names in ParentStory, and what the design map lists in StoryList. A story may also
hold a StoryPreference child (optical margin alignment) and InCopyExportOption.
| Attribute · Story | Values | Seen in |
|---|---|---|
| Self | id | 100% |
| AppliedNamedGrid | — | 75% |
| AppliedTOCStyle | reference | 75% |
| StoryTitle | builtin | 75% |
| TrackChanges | false | 75% |
| UserText | boolean | 70% |
ParagraphStyleRange
AppliedParagraphStyle names the paragraph style. Any other attribute on the element is
a local override that wins over the style for every paragraph in the run. Some
properties are written as typed children of a Properties element instead of
attributes: the TabList, the numbering format and list, and the span column count among them
(see lists, keep options and span columns).
| Attribute · ParagraphStyleRange | Values | Seen in |
|---|---|---|
| AppliedParagraphStyle | ParagraphStyle reference | 100% |
| Justification | LeftAlign | CenterAlign | RightAlign | LeftJustified | CenterJustified | RightJustified | FullyJustified | ToBindingSide | AwayFromBindingSide | 17% |
| HyphenationZone | length (pt) | 9% |
| RuleAboveLineWeight | real | 9% |
| RuleBelowLineWeight | integer / real | 9% |
| Hyphenation | false | 8% |
| SplitColumnInsideGutter | length (pt) | 8% |
| ParagraphBorderTopLeftCornerRadius | integer / real | 8% |
| ParagraphBorderBottomLeftCornerRadius | integer / real | 7% |
| ParagraphBorderBottomRightCornerRadius | integer / real | 7% |
CharacterStyleRange
AppliedCharacterStyle names the character style; other attributes are local overrides.
The font and the leading are typed Properties children, written as
<Properties><AppliedFont type="string">Open Sans</AppliedFont></Properties> and
<Leading type="unit">14</Leading> (or type="enumeration" with Auto). InDesign
ignores an AppliedFont attribute.
| Attribute · CharacterStyleRange | Values | Seen in |
|---|---|---|
| AppliedCharacterStyle | CharacterStyle reference | 100% |
| PointSize | length (pt) | 25% |
| AppliedFont | ref | 22% |
| FillColor | Color reference | 20% |
| FontStyle | text | 18% |
| Leading in Properties | length (pt) | 17% |
| Tracking | number | 14% |
| StrokeWeight | integer / real | 12% |
| MiterLimit | integer / real | 11% |
| KentenFontSize | real | 8% |
What else a story can contain
A CharacterStyleRange is also where IDML places everything that flows with the text:
- Tables (
Table), each standing in for one character of the paragraph. See tables in text flow. - Anchored and inline objects: a
TextFrame,RectangleorGroupplaced in the run. See anchored objects. - Footnotes (
Footnote), whose body is its own nestedParagraphStyleRange. Parsed, partly rendered - Hyperlink sources (
HyperlinkTextSource), wrapping the linked characters. See hyperlinks and bookmarks. - Text variable instances (
TextVariableInstance), with the last composed value inResultText. - XML tagging (
XMLElement), which can wrap ranges. See the structured-content layer. - Notes and tracked changes (
Note,Change). A note is not part of the printed text. A story with tracked changes prints as if every change were accepted: text inside<Change ChangeType="DeletedText">is left out, and inserted or moved text prints in place. Supported · verified - Ruby (
RubyFlag,RubyString), set as attributes on the range. Supported · verified
Frequently asked questions
How many paragraphs does a story have?
Count the <Br/> marks and add one (for a non-empty story). The number of
ParagraphStyleRange elements is the number of style runs, which is smaller whenever
consecutive paragraphs share their paragraph attributes.
What is the difference between <Br/> and a forced line break?
<Br/> ends the paragraph: the next text starts a new paragraph with its first-line
indent, space before and list marker. A forced line break, U+2028 inside Content,
only ends the line; the paragraph continues.
How is a tab written?
As the tab character U+0009 inside Content. There is no tab element. The positions
the tab moves to are the TabList records on the paragraph.
Why do two paragraphs sit in one ParagraphStyleRange?
Because they share the same paragraph attributes. A range is a style run; a new one
starts only where something about the paragraph's formatting changes.
Where does the literal text live?
Only in Content elements. Several Content elements in a row, separated by <Br/>
marks or other children, are simply consecutive text.
Your first story
Build up an IDML story in three steps — one line of text, a second paragraph with the <Br/> mark, then a change of formatting with a new range.
The paragraph model
Why IDML stores text as flat style runs with an in-band paragraph mark, instead of one element per paragraph — and what that means when you read or write it.