Paged.The open publishing system
The format atlas
Stories & text

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.

Tier: ProProIIIreference

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 paragraph

Paragraphs 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.

Stories/Story_ustory.xmlRead / the source
<?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&#x2028;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 XMLCharacterEffect
<Br/>paragraph markEnds the paragraph. Omitted after the story's last paragraph.
U+2028 in Contentforced line breakBreaks the line; the paragraph continues (no new first-line indent, no space before).
U+0009 in ContenttabMoves the text after it to the next tab stop of the paragraph's TabList.
<?ACE 18?> in Contentpage numberThe current page number, or the next/previous one when the range carries PageNumberType.
<?ACE 19?> in Contentsection markerThe 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 &#9; 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 · StoryValuesSeen in
Selfid100%
AppliedNamedGrid—75%
AppliedTOCStylereference75%
StoryTitlebuiltin75%
TrackChangesfalse75%
UserTextboolean70%
The 6 attributes real documents use most. Seen in: the share of documents with a Story that set it. All 10 attributes of Story; what Paged reads, edits and writes is in its Paged support panel.

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 · ParagraphStyleRangeValuesSeen in
AppliedParagraphStyleParagraphStyle reference100%
JustificationLeftAlign | CenterAlign | RightAlign | LeftJustified | CenterJustified | RightJustified | FullyJustified | ToBindingSide | AwayFromBindingSide17%
HyphenationZonelength (pt)9%
RuleAboveLineWeightreal9%
RuleBelowLineWeightinteger / real9%
Hyphenationfalse8%
SplitColumnInsideGutterlength (pt)8%
ParagraphBorderTopLeftCornerRadiusinteger / real8%
ParagraphBorderBottomLeftCornerRadiusinteger / real7%
ParagraphBorderBottomRightCornerRadiusinteger / real7%
The 10 attributes real documents use most. Seen in: the share of documents with a ParagraphStyleRange that set it. All 64 attributes of ParagraphStyleRange; what Paged reads, edits and writes is in its Paged support panel.

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 · CharacterStyleRangeValuesSeen in
AppliedCharacterStyleCharacterStyle reference100%
PointSizelength (pt)25%
AppliedFontref22%
FillColorColor reference20%
FontStyletext18%
Leading
in Properties
length (pt)17%
Trackingnumber14%
StrokeWeightinteger / real12%
MiterLimitinteger / real11%
KentenFontSizereal8%
The 10 attributes real documents use most. Seen in: the share of documents with a CharacterStyleRange that set it. All 57 attributes of CharacterStyleRange; what Paged reads, edits and writes is in its Paged support panel.

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, Rectangle or Group placed in the run. See anchored objects.
  • Footnotes (Footnote), whose body is its own nested ParagraphStyleRange. Parsed, partly rendered
  • Hyperlink sources (HyperlinkTextSource), wrapping the linked characters. See hyperlinks and bookmarks.
  • Text variable instances (TextVariableInstance), with the last composed value in ResultText.
  • 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.

On this page