Skip to main content

Module elements

Module elements 

Source
Expand description

Constructors for every HTML element Winged-Swift supports.

Winged-Swift has one Swift file per tag — 93 of them — because Swift needs a class per tag to hang a typed initializer on. Rust does not: all 93 reduce to a handful of shapes, so they are generated from one table here. The public surface is the same; the source is roughly 200 lines instead of 93 files.

One tag is renamed back to its HTML spelling: Winged-Swift calls it VarTag because var is a Swift keyword, which Rust’s var is not. <main> keeps a suffix — see main_tag for why.

Constants§

ALL_TAGS
Every tag this crate can build, as (constructor name, tag name).

Functions§

a
A hyperlink: <a>.
abbr
An abbreviation or acronym: <abbr>.
address
Contact information: <address>.
article
A self-contained composition: <article>.
aside
Tangential content: <aside>.
audio
Embedded sound: <audio>.
base
The document base URL: <base>.
blockquote
An extended quotation: <blockquote>.
body
The document body: <body>.
br
A line break: <br>.
button
A button: <button>.
button_typed
A <button type="…">. Winged-Swift defaults the type to "button".
canvas
A drawing surface: <canvas>.
caption
A table caption: <caption>.
cite
A cited creative work: <cite>.
code
Inline code: <code>. Whitespace-sensitive.
col
A table column: <col>.
colgroup
A column group: <colgroup>.
datalist
A list of predefined options: <datalist>.
dd
A description detail: <dd>.
del
Deleted text: <del>.
details
A disclosure widget: <details>.
dialog
A dialog box: <dialog>.
div
A generic block container: <div>.
dl
A description list: <dl>.
dt
A description term: <dt>.
em
Stress emphasis: <em>.
embed
External content: <embed>.
fieldset
A group of form controls: <fieldset>.
figcaption
A figure caption: <figcaption>.
figure
Self-contained content with an optional caption: <figure>.
footer
A footer: <footer>.
form
A form: <form>.
h1
A top-level heading: <h1>.
h2
A second-level heading: <h2>.
h3
A third-level heading: <h3>.
h4
A fourth-level heading: <h4>.
h5
A fifth-level heading: <h5>.
h6
A sixth-level heading: <h6>.
head
Document metadata container: <head>.
header
Introductory content: <header>.
hr
A thematic break: <hr>.
html_tag
The document root: <html>.
i
Text in an alternate voice: <i>.
iframe
A nested browsing context: <iframe>. Prefer iframe_titled, which cannot be built without the title an assistive technology needs.
iframe_titled
An <iframe> that cannot be built without a title.
image
An image with its src and alt: <img src="…" alt="…">.
img
An image: <img>.
input
A form control: <input>.
input_named
An <input type="…" name="…">.
ins
Inserted text: <ins>.
kbd
Keyboard input: <kbd>.
label
A caption for a form control: <label>.
label_for
A <label for="…">.
legend
A caption for a fieldset: <legend>.
li
A list item: <li>.
link
An external resource link: <link>.
link_to
A hyperlink with its href: <a href="…">.
main_tag
The dominant content of the body: <main>.
mark
Marked or highlighted text: <mark>.
meta
Document metadata: <meta>. See crate::seo for the typed constructors.
meter
A scalar measurement within a range: <meter>.
nav
Navigation links: <nav>.
noscript
Fallback for disabled scripting: <noscript>.
ol
An ordered list: <ol>.
optgroup
A group of options: <optgroup>.
option
An option in a select: <option>.
output
The result of a calculation: <output>.
p
A paragraph: <p>.
picture
A responsive image container: <picture>.
pre
Preformatted text: <pre>. Whitespace-sensitive.
progress
Task completion progress: <progress>.
q
A short inline quotation: <q>.
samp
Sample program output: <samp>.
script
A script: <script>. Content is not escaped by default — use Element::raw_text.
script_src
A <script src="…">.
section
A thematic grouping: <section>.
select
A drop-down list: <select>.
small
Side comments and fine print: <small>.
source
A media resource: <source>.
span
A generic inline container: <span>.
strong
Strong importance: <strong>.
style
Embedded CSS: <style>. Content is not escaped by default.
stylesheet
A stylesheet link: <link href="…" rel="stylesheet">.
sub
Subscript: <sub>.
summary
A disclosure summary: <summary>.
sup
Superscript: <sup>.
table
A table: <table>.
tbody
The table body: <tbody>.
td
A table cell: <td>.
textarea
A multi-line text control: <textarea>.
tfoot
The table footer: <tfoot>.
th
A table header cell: <th>.
thead
The table header: <thead>.
time
A machine-readable date or time: <time>.
title
The document title: <title>.
tr
A table row: <tr>.
track
A timed text track: <track>.
ul
An unordered list: <ul>.
var
A variable name: <var>. Winged-Swift calls this VarTag.
video
Embedded video: <video>.
wbr
A line-break opportunity: <wbr>.