The writing app I want

I have a pretty clear idea of the writing app I want, and I don't think it exists. What I'm looking for is an app which lets me control a document's content, structure, and presentation separately from one another, at composition time.

Usually, content, structure, and presentation are all mingled together. Word processors combine all of them, using rich formatting to represent the presentation of the content, inseparably from its structure and meaning. In a word processor, a heading is only a heading because it happens to be bigger and bolder. The application doesn't know it's a heading. You can often define preset "styles," allowing you at least to control their appearance consistently, but you can't do things like re-order the document based on the heading structure. You can't decide to put headings on a separate page without literally changing the content (to add a page break). A word processor prioritizes the final output's presentation above all else.

Minimal text editors (like iA Writer) do not emphasize control over the output, but instead they comingle structure and content by usually requiring something like Markdown. Markdown is a syntax, meaning that the content itself dictates its own structure. For example, line breaks separate paragraphs. Headings have special punctuation. Blockquotes have indentation. This system has advantages like letting you choose the font in which you write without changing the final document's appearance or structure, but you still can't focus solely on the content without also paying attention to the syntax.

The worst part of any Markdown-like editor is that they envision writing as a kind of programming process. You're not writing a document; you're writing instructions to write a document, which must then be compiled. I find this to be a moribund approach to creation, leftover as an artifact of early computers that used primarily text-based interfaces. The technology exists to let us create more directly, with less technology as an intercessor, and we should demand it.

Outlining apps solve for much of this, allowing real-time manipulation of a non-linear structure, but you lose too much control elsewhere. Most outlining apps have only the barest formatting. Structure remains only as discrete, hierarchical nodes, and everything you write must be coerced into it, no exceptions. This makes it much harder to adjust the boundaries between sections, or create more complex documents like chiastic structures or hypertexts.

In a hypothetical writing app which lets me handle structure, content, and presentation freely and separately, a much more direct and non-linear creative process emerges. For example, I often want to build a document structure, starting from a simple list of points, structuring that into an outline, restructuring that into a matrix or timeline, and then arranging the elements of that structure until it builds the full document. Then having built it, I still want access to the structural elements I used, even while controlling the final output.

I can cobble together a process from many tools to get close to my ideal, but the process itself can become a distraction and an impediment. I still haven't found one application that has met all of the above criteria, and most of them still have significant problems, or at least an unimaginative take on how writing can work.