Explanation

Background, design rationale, and the conceptual model behind tagz. Read these when you want to understand why the library behaves the way it does — not how to call it.

What’s here?

  • Why no templates? — the case for Python-as-template and where Jinja2 still wins.

  • Architecture — the class hierarchy: Tag, TagInstance, Fragment, Raw, Page, and how they relate.

  • The escaping model — exactly where html.escape() is called, and why <script> and <style> are exceptions.

  • Rendering and streaming — the three iter-methods, what pretty=True does and doesn’t promise.

  • Callables and laziness — when callables run, how often, and what that means for side effects.

  • Async and tagz — the tagz.aio mirror with async render and streaming via iter_chunk / iter_lines.