Skip to content

Layout: only Paragraph supports inline runs — Heading and ListItem take one string #367

Description

@Tim81

Paragraph supports mixed inline styling — it takes IEnumerable<TextRun> and has
Add(string, TextStyle?). No other text-bearing element does.

Element Constructor Content
Paragraph Paragraph(IEnumerable<TextRun>), Add(string, TextStyle?) runs
Heading Heading(string text, TextStyle? style) one string, one style
ListItem ListItem(string text, TextStyle? style) one string, one style
Cell Cell(string content) one string — see L0c

ListItem.AddChild adds nested list items, not inline content, so it does not help.

What that makes impossible

Ordinary things, not exotic ones:

  • bolding or italicising a word in a heading — "The Save method", "Ceci and cela"
  • a link inside a list item — arguably the single most common thing a list item contains
  • a superscript, a subscript, or a footnote reference (L12) anywhere but a paragraph
  • a differently-languaged run inside a heading, which PDF/UA-2 §8.4.4 requires be declarable at the
    point the language changes — currently only Heading.Language exists, applying to the whole heading

That last one is a conformance consequence, not just a convenience one.

Scope

Heading and ListItem take runs, exactly as Paragraph does. The single-string constructors stay —
they are Shipped, and they are the common case — as conveniences over the general form.

This is the same content-model problem as L0c, and the three should be solved together with one shape
rather than three similar ones.

Acceptance

  • A heading with a bolded word and an inline code span.
  • A list item containing a link and a footnote reference.
  • A run in a different language inside a heading, emitting /Lang on the right structure element.
  • Existing single-string constructors produce byte-identical output.
  • Structure tree correct: inline runs inside a heading are content items of one Hn, not separate
    elements — the same principle L0a establishes for fragments.

Relates to

  • L0c — table cells, the third member of this family.
  • L0a — one structure element per logical element.
  • L12, L26, L28 — footnote references, decoration and links, all of which need somewhere inline to live.

Plan labels used above, resolved: L0a #285 · L0c #287 · L12 #297 · L28 #299 · L26 #305.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/layouthigh-level document/layout enginetype/featurenew capability

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions