Rendering Behavior
This page describes what the default pipeline actually outputs. The library does not infer semantics for appearance: structures that cannot be rendered safely or correctly become source cards or explicit placeholders. To look up a single construct, see Syntax support.
Paragraphs, text, and formatting
- Consecutive inline content becomes
<p class="wtr-paragraph">; two or more blank lines split paragraphs, and a single newline collapses to a space. - Bold and italic come from MediaWiki quote syntax and render as
<b>/<i>. When both are open, the output is<i><b>…</b></i>. - Headings render as real
<h1>–<h6 class="wtr-heading">and participate in anchors and the table of contents. - Horizontal rules render as
<hr class="wtr-hr">. - Comments, categories, and behavior switches do not enter the body. Categories go to the footer; behavior switches only affect the table of contents.
Lists
*,#,;, and:prefixes produce nested<ul>,<ol>, and<dl>/<dt>/<dd>.- Continuation lines join the current list item; blank lines, headings, tables, and block HTML end a list.
- Definition lists support both
; term : definitionand;term:definition. - List scanning inside a table cell is bounded by the cell range and never consumes the next cell.
Tables
- The output order is
<table><caption>…</caption><tbody>…; cells are<th>/<td>. - Table, row, and cell attributes are kept through a whitelist;
stylekeeps only a safe layout subset, while event attributes andidare always dropped. - Layout is computed on a logical grid:
colspan/rowspanare clamped to the table bounds, and missing slots get filler cells (wtr-table__cell--filler). - Nested wikitext tables degrade to a source card. Nested HTML
<table>renders normally. - Tables allow safe
data-*attributes but reject library-reserved names such asdata-node-idanddata-wikitext.
Links
Internal links produce an <a> only when resolveLink returns an href. External links allow only http:, https:, and mailto:; protocol-relative addresses gain https:. javascript:, data:, and obfuscated variants are blocked and degrade to readable text.
External links default to target="_blank" and rel="nofollow noopener noreferrer", adjustable through policy.externalLinkTarget or the resolver's target. See Links and images.
Files and images
File nodes render as a placeholder by default:
- Inline files use
<span class="wtr-file">; block files use<figure>. - Captions come from the real subtree, so links and template placeholders inside them render recursively.
- Only a
srcreturned byresolveImageand validated ashttp:/https:produces<img loading="lazy" decoding="async">; dimensions are clamped to 1–4096. - The library never contacts
upload.wikimedia.orgor any image URL on its own.
Templates, functions, and arguments
The default pipeline does not evaluate anything:
- Templates render as a block
<details class="wtr-template">or an inline badge listing their parameters, usinglabels.templateNotExpanded. - Parser functions render the same kind of placeholder and are explicitly marked as not evaluated.
- Arguments
{{{name|default}}}show the name and default value. - Magic words inside templates, functions, and arguments do not affect the table of contents or categories.
Use /expand when you need expansion. Calls that were preserved after a failed expansion continue to render as placeholders.
References
- Each
<ref>is numbered within its group and produces<sup class="reference wtr-ref">with a numbered link. - Reference content is collected into
<section class="wtr-references" role="doc-endnotes">; named references reuse the same entry and groups number independently. <references/>or<references group="x"/>places the matching group section; groups without a marker are appended after the body and before the category footer. Notes carrya[role="doc-backlink"]backlinks.- Duplicate definitions and empty references produce diagnostics; repeated uses get
cite_ref-N,cite_ref-N-2, and so on.
Table of contents
- Once a page has four headings, a table of contents is generated before the top-level block that contains the first heading (headings may live inside block HTML).
- The
tocprepare option adjustsminHeadings,columns, or disables the TOC. __TOC__forces a table of contents at its marker;__FORCETOC__forces an automatic one;__NOTOC__disables it anywhere and takes precedence.- The table includes levels, numbers, text, and
#anchorlinks. Fragment-sensitive characters are encoded as.HH; withheadingIdStrategy: "none"it contains text only. - It has no scroll synchronization, collapse, or sticky behavior.
Categories and redirects
- Categories stay out of the body and are collected in source order into
div.catlinks.wtr-categoriesat the end. Namespace prefixes are removed, underscores become spaces, and sort keys are not displayed. - A first-line
#REDIRECTrenders a redirect banner and skips the rest of the body. It does not load the target page.
HTML
Source HTML is never injected as raw HTML. The library handles categories:
- Inline tags:
b,i,u,span,code,ruby,abbr, and similar. - Block tags:
div,p,blockquote,center,pre, lists, tables, headings, and similar. - Void tags:
br,wbr,hr. - Dropped:
meta,link. - Forbidden:
script,style,iframe,object,embed, form controls,svg, HTMLmath, and similar. The default config does not parse these tags, so source stays escaped text; if configured as HTML, the whole pair is dropped and replaced with a readable hint. - Unknown but non-dangerous tags: rendered as source cards, not real elements.
HTML attributes keep only class, title, dir, lang, safe style, and table-related attributes from the whitelist. id and event attributes never reach the DOM. See the security model.
Extension tags
semanticComponents.extension can take over these structures by name. <ref> uses semanticComponents.reference, and <references> produces no component call.
Unknown structures and degradation
Unrecognized semantic nodes, complex HTML that cannot be paired safely, and nested wikitext tables render as source cards and record diagnostics. If one block fails to render, the error boundary replaces only that top-level block; the rest of the page continues. onRenderError reports the failing node.
Accessibility
The library emits semantic structure, but it is not a complete accessibility layer:
- The root container only sets the
langanddiryou pass; otherwise it inherits from the host. - Headings use real
<h1>–<h6>elements; see Styling and components for anchor strategies. - The TOC is a
navwitharia-labeltext fromlabels.toc. - The reference section is
section[role="doc-endnotes"]; reference links carry an "Reference N"aria-label. - The category area uses
role="navigation"with a visible label. - Image
altcomes fromresolveImage'salt, thealt=parameter, or the file name. - Some hints (blocked HTML, degraded tables, redirects) use
role="note"text. - The library does not manage focus, provide skip links, or use live regions; pin
idPrefixon pages with multiple instances. - There is no screen-reader test suite or accessibility certification; verify against your target standard.
Stable limitations
These limits come from parser capabilities or project scope and will not disappear as development continues:
If output differs from the default behavior, start with Troubleshooting.