--- id: MD-1 family: RT-MD level: extended profiles: [runtime] posture: normative-target added: "1.0" changed: "1.0" source: https://flowdrop.io/spec/rules/rt-md/md-1 specification: FlowDrop Workflow Specification 1.0 licence: CC BY 4.0 --- # MD-1 — Markdown source can never reach the reader as markup *RT-MD (Part II) · level: extended · profiles: runtime · added in 1.0* 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 NOT 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: ```json title="Markdown with a tag inside the text" "Hello there" ``` ```json title="What the paragraph carries" verdict="encoded" "

Hello <script>alert(1)</script> there

" ``` The same holds when the tag is the very first thing in the block, not something the paragraph wraps around: ```json title="Markdown that opens with a tag" "" ``` ```json title="What the paragraph carries" verdict="encoded" "

<script>alert(1)</script>

" ``` ## Why Recorded under [OPEN-25](https://flowdrop.io/spec/rulings/open-25). ## Related rules - Referenced by: MD-2 --- Rule identifiers are permanent and are never renumbered. This specification carries no implementation status: each implementation publishes its own standing against these rules. Licensed CC BY 4.0.