FlowDrop Workflow Specification 1.0-draft

Markdown source can never reach the reader as markup

A markdown-to-HTML conversion usually runs over text a language model wrote, so the encoding is a safety boundary rather than a formatting nicety. Encoding the whole input once, before any block or inline pattern is applied, is the arrangement that makes the promise hold on every arm: escaping at each emission point has been shown to miss the blocks a converter rebuilds from its buffer, and to miss any block whose first character is already a tag.

The rule

Normative: this is the rule
  1. Every text node a markdown-to-HTML conversion emits must be HTML-encoded: prose, list items, blockquote lines, headings and code alike.
  2. Markup present in the markdown source must never reach the reader as markup, including where a block opens with a tag.

What it means

Encoding happens over the whole input before any block or inline pattern is applied — not at each place text later gets written out. The clause that bites is the one about where a block starts: a block whose very first character is a tag does not get a free pass just because it looks, at that point, like it is already built. Nothing survives from the source that the conversion did not write itself, wherever in the block it sits.

Example

Markup buried inside a line of prose:

Markdown with a tag inside the text
"Hello <script>alert(1)</script> there"
What the paragraph carriesencoded
"<p>Hello &lt;script&gt;alert(1)&lt;/script&gt; there</p>"

The same holds when the tag is the very first thing in the block, not something the paragraph wraps around:

Markdown that opens with a tag
"<script>alert(1)</script>"
What the paragraph carriesencoded
"<p>&lt;script&gt;alert(1)&lt;/script&gt;</p>"
Rule identifiers are permanent and are never renumbered. Each implementation publishes its own standing against these rules; this specification does not.spec 1.0-draft · MD-1 · changed in spec 1.0