This basically cannot be done in InDesign. Unlike FrameMaker, ID does not have run-in or side-head style options. Everything in your sample paragraphs would have to be one Paragraph Style, although a GREP or Nested Style could be used to apply a Character Style for those headings. But TOCs work on Paragraph Styles only, so there's no way to snag a heading formatted like that as a separate element.
The only way I can see to accomplish this is to use a heading style combined with a body style that has zero leading between them (I think the approach is to apply zero leading to the first paragraph), with a fixed starting indent for the body paragraph. That would wrap the copy up to the heading, but with variable space between them on the line and a fixed limit to how long the heading text could be. Very clumsy unless the content is very regular in size (all headings about 25 characters long, for example).
(ETA: And in a quick test, I can't make that work — it works only for a single line overall. I am pretty sure I had a method for multi-line body text but can't bring it to mind...)
Heading over a body paragraph is the only easy method to achieve your TOC (and probably accessibility) goals. Anything else is going to require some very convoluted layout (such as hidden header paragraphs for the TOC only) that would work for layout but probably be completely incompatible with accessibility.
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.
