Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax highlighting for html techniques #3381

Closed
wants to merge 69 commits into from
Closed
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
26f403a
Update H2
fstrr Sep 1, 2023
5254832
Update h24 for syntax highlighting
fstrr Sep 1, 2023
7fee788
Update h25 for syntax highlighting support
fstrr Sep 1, 2023
3bea235
Update h28
fstrr Sep 1, 2023
be168c2
Update h30 for syntax highlighting support
fstrr Sep 1, 2023
0cc7e43
Update h32 for syntax highlighting support
fstrr Sep 1, 2023
8b1b956
Update H33
fstrr Sep 1, 2023
2fc240a
Update H34 - update out of date resource links
fstrr Sep 1, 2023
6f354cc
Update h36 for syntax highlighting
fstrr Sep 1, 2023
1aebc64
Update h37 for syntax highlighting
fstrr Sep 1, 2023
3c191e6
Update H39 for syntax highlighting
fstrr Sep 5, 2023
8a1c27b
Update H40 for syntax highlighting
fstrr Sep 5, 2023
0e7d7d8
Update h42 for syntax highlighting
fstrr Sep 5, 2023
a7fe836
Update h43 for syntax highlighting
fstrr Sep 5, 2023
1e45360
Update h44 for syntax highlighting
fstrr Sep 5, 2023
3d7f985
H48 update el class
fstrr Sep 5, 2023
b3992d0
Update el class attributes
fstrr Sep 5, 2023
ae307e4
Update H49 for syntax highlighting
fstrr Sep 5, 2023
5e03dd1
Update H51 for syntax highlighting
fstrr Sep 5, 2023
2ec5538
Update H53
fstrr Sep 5, 2023
f717de5
Update H54
fstrr Sep 5, 2023
7073de2
Update H56
fstrr Sep 5, 2023
eba5219
Update H57 for syntax highlighting
fstrr Sep 7, 2023
12352df
Update H58 for syntax highlighting
fstrr Sep 7, 2023
4ae5cc4
Update H59 for syntax highlighting
fstrr Sep 7, 2023
0f062c2
H58: add lang to German code sample
fstrr Sep 7, 2023
4211805
Update H62
fstrr Sep 7, 2023
80e2514
Update H63
fstrr Sep 7, 2023
eccb389
Update H64 for syntax highlighting
fstrr Sep 7, 2023
4218577
Update H65
fstrr Sep 8, 2023
28c39b3
Update H67 for syntax highlighting
fstrr Sep 8, 2023
d542364
Update H69 for syntax highlighting
fstrr Sep 8, 2023
bf3f428
Update H88
fstrr Sep 8, 2023
25f573c
Update H89
fstrr Sep 8, 2023
6a3c72d
Update H90
fstrr Sep 8, 2023
d761be9
Update H91
fstrr Sep 8, 2023
5d8a16d
Update H93
fstrr Sep 8, 2023
58343f7
Updated H70
fstrr Sep 8, 2023
137d635
Update H71 for syntax highlighting
fstrr Sep 8, 2023
f0abd0d
Update H74 text tweak
fstrr Sep 8, 2023
bf6f10c
Update H75
fstrr Sep 8, 2023
bfa5a30
Update H76 for syntax highlighting
fstrr Sep 8, 2023
b349929
Update H77 for syntax highlighting
fstrr Sep 8, 2023
f26eb98
Update H78 for syntax highlighting
fstrr Sep 8, 2023
2028ac4
Update H79 for syntax highlighting
fstrr Sep 8, 2023
1b94aeb
Update H80 for syntax highlighting
fstrr Sep 8, 2023
5522425
Update H81 for syntax highlighting
fstrr Sep 8, 2023
56bf3ff
Update H83 for syntax highlighting
fstrr Sep 8, 2023
a8eded6
Update H84 for syntax highlighting
fstrr Sep 8, 2023
e2d8bb2
Update H85 for syntax highlighting
fstrr Sep 8, 2023
ffabfd1
Update H86 for syntax highlighting
fstrr Sep 8, 2023
d357d07
Update H94 for syntax highlighting
fstrr Sep 8, 2023
9b0b867
Update H95
fstrr Sep 8, 2023
56701ba
Update H96
fstrr Sep 8, 2023
9a14316
Update H97 for syntax highlighting
fstrr Sep 8, 2023
8094137
Update H98 for syntax highlighting
fstrr Sep 8, 2023
7e65db8
Update H99
fstrr Sep 8, 2023
0d04f27
Update H100 for syntax highlighting
fstrr Sep 8, 2023
9dd6fcc
Update H101 for syntax highlighting (and a typo)
fstrr Sep 8, 2023
557739e
Adding an abbr
fstrr Sep 8, 2023
000ff46
Merge branch 'main' into syntax-highlighting-for-html-techniques
fstrr Sep 18, 2023
b9baf15
Update techniques/html/H100.html
patrickhlauke Nov 29, 2023
bd25fe8
Fixes
patrickhlauke Nov 29, 2023
b6e1cbd
preserve whitespace for `<pre>`
patrickhlauke Nov 29, 2023
619150a
Replace closing `<link …></link>` with self-closing `<link … />`
patrickhlauke Nov 29, 2023
7b99c31
Merge branch 'main' into syntax-highlighting-for-html-techniques
fstrr Feb 24, 2024
6687d75
Errent attribute
fstrr Feb 24, 2024
1eac134
Errent attribute
fstrr Feb 24, 2024
dbe4723
Fixing sectioning
alastc Feb 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions techniques/html/H100.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">

<head>
<title>Providing properly marked up email and password inputs</title>
<link rel="stylesheet" type="text/css" href="../../css/editors.css" />
</head>

<body>
<h1>Providing properly marked up email and password inputs</h1>
<section id="meta">
Expand All @@ -26,23 +24,19 @@ <h2>Description</h2>
<h2>Examples</h2>
<section class="example">
<h3>properly marked up email and password inputs</h3>
<p>A secure website has an email and password based login form. </p>
<pre>
<code class="language-html">
&lt;form method=&quot;post&quot; action=&quot;login&quot;&gt;
&lt;div&gt;
&lt;label for=&quot;email&quot;&gt;Email&lt;/label&gt;
&lt;input id=&quot;email&quot; type=&quot;email&quot; autocomplete=&quot;email&quot; ... &gt;
<p>A secure website has an email and password based login form.</p>
<pre><code class="language-html">&lt;form method="post" action="login"&gt;
&lt;div&gt;
&lt;label for="email"&gt;Email&lt;/label&gt;
&lt;input autocomplete="email" id="email" type="email" ...&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;label for=&quot;password&quot;&gt;Password&lt;/label&gt;
&lt;input id=&quot;password&quot; type=&quot;password&quot; autocomplete=&quot;current-password&quot; ... &gt;
&lt;label for="password&quo"&gt;Password&lt;/label&gt;
patrickhlauke marked this conversation as resolved.
Show resolved Hide resolved
&lt;input autocomplete="current-password" id="password" type="password" ...&gt;
&lt;/div&gt;
&lt;input type=&quot;submit&quot; value=&quot;Login&quot; &gt;
&lt;input type="submit" value="Login"&gt;
&lt;/div&gt;
&lt;/form&gt;
</code>
</pre>
&lt;/form&gt;</code></pre>
</section>
</section>
<section id="tests">
Expand All @@ -69,5 +63,4 @@ <h2>Resources</h2>
</ul>
</section>
</body>

</html>
18 changes: 9 additions & 9 deletions techniques/html/H101.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@ <h2>Examples</h2>
<section class="example" id="simple-identical-landmarks">
<h3>Simple landmarks</h3>
<p>The following example shows how landmarks might be added to an HTML document:</p>
<pre xml:space="preserve">&lt;header&gt; site logo and name, etc. here &lt;/header&gt;
<pre xml:space="preserve"><code class="language-html">&lt;header&gt; site logo and name, etc. here &lt;/header&gt;
&lt;form aria-label="site search"&gt; search functionality here &lt;/form&gt;
&lt;nav&gt; a list of navigation links here &lt;/nav&gt;
&lt;main&gt; the page's main content here &lt;/main&gt;
&lt;section&gt; a sponsor's promotion here &lt;/aside&gt;
&lt;section&gt; a sponsor's promotion here &lt;/section&gt;
&lt;aside&gt; sidebar content here &lt;/aside&gt;
&lt;footer&gt; site contact details, copyright information, etc. here &lt;/footer&gt;</pre>
&lt;footer&gt; site contact details, copyright information, etc. here &lt;/footer&gt;</code></pre>
</section>

<section class="example" id="multiple-landmarks-aria-labelledby">
<h3>Multiple landmarks of the same type and aria-labelledby</h3>

<p>The following example shows a best practice of how landmarks might be added to an HTML document in situations where there are two or more of the same type of landmark on the same page. For instance, if a <code class="language-html">nav</code> element is used multiple times on a page, each instance may have a unique label specified using <code class="language-html">aria-labelledby</code>:</p>
<pre xml:space="preserve">&lt;nav aria-labelledby="site-nav-heading"&gt;
<pre xml:space="preserve"><code class="language-html">&lt;nav aria-labelledby="site-nav-heading"&gt;
&lt;h2 id="site-nav-heading"&gt;Site&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="/news"&gt;News&lt;/a&gt;&lt;/li&gt;
Expand All @@ -76,14 +76,14 @@ <h3>Multiple landmarks of the same type and aria-labelledby</h3>
&lt;li&gt;&lt;a href="/local-weather"&gt;Local Weather&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/local-sport"&gt;Local Sport&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;</pre>
&lt;/nav&gt;</code></pre>
</section>

<section class="example" id="multiple-landmarks-aria-label">
<h3>Multiple landmarks of the same type and aria-label</h3>

<p>The following example shows a best practice of how landmarks might be added to an HTML document in situations where there are two or more of the same type of landmark on the same page, and there is no existing text on the page that can be referenced as the label:</p>
<pre xml:space="preserve">&lt;nav aria-label="Vehicles"&gt;
<pre xml:space="preserve"><code class="language-html">&lt;nav aria-label="Vehicles"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a aria-current="page" href="/cars"&gt;Cars&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/trucks"&gt;Trucks&lt;/a&gt;&lt;/li&gt;
Expand All @@ -98,17 +98,17 @@ <h3>Multiple landmarks of the same type and aria-label</h3>
&lt;li&gt;&lt;a href="/cars-working"&gt;Rugged Cars For Working&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="/cars-commuting"&gt;Cars For Suburban Commuting&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/nav&gt;</pre>
&lt;/nav&gt;</code></pre>
</section>

<section class="example" id="search-form">
<h3>Search form</h3>
<p>The following example shows a search form. A <code class="language-html">form</code> element must have an accessible name to be exposed as a landmark area:</p>
<pre xml:space="preserve">&lt;form aria-labelledby="search-label"&gt;
<pre xml:space="preserve"><code class="language-html">&lt;form aria-labelledby="search-label"&gt;
&lt;label for="product-search" id="search-label"&gt;Search&lt;/label&gt;
&lt;input id="product-search" placeholder="title, author, or ISBN" type="text"&gt;
&lt;button type="submit"&gt;Find Books&lt;/button&gt;
&lt;/form&gt;</pre>
&lt;/form&gt;</code></pre>
</section>
</section>
<section id="tests">
Expand Down
25 changes: 10 additions & 15 deletions techniques/html/H2.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,32 @@ <h1>Combining adjacent image and text links for the same resource</h1>
</section>
<section id="applicability">
<h2>When to Use</h2>
<p>HTML documents that contain links.</p>
<p><abbr title="HyperText Markup Language">HTML</abbr> documents that contain links.</p>
</section>
<section id="description">
<h2>Description</h2>
<p>This objective of this technique is to provide both text and iconic representations of links without making the web page more confusing or difficult for keyboard users or assistive technology users. Since different users finding text and icons more usable, providing both can improve the accessibility of the link.</p>
<p>Many links have both a text and iconic representation adjacent to each other, but rendered in separate <code class="language-html">a</code> elements. Visually they appear to be a single link, but many users encounter them as adjacent identical links. For a keyboard user, it is tedious to navigate through redundant links. For users of assistive technologies, it can be confusing to encounter successive identical links. When the text alternative for the icon is a duplicate of the link text, it is repetitive as screen readers read the description twice.</p>
<p>If the author omitted alternative text from the link image, it would fail <a href="https://www.w3.org/TR/WCAG21/#text-equiv-all">Success Criterion 1.1.1</a> because the text alternative would not serve the same purpose as the graphical link.</p>
<p>If the author omitted alternative text from the link image, it would fail <a href="https://www.w3.org/WAI/WCAG22/Understanding/non-text-content.html">Success Criterion 1.1.1</a> because the text alternative would not serve the same purpose as the graphical link.</p>
<p>This technique provides such links by putting the text and image together in one <code class="language-html">a</code> element and providing null alternative text on the image to eliminate duplication of text. In this way, both representations of the link are provided, but keyboard users only encounter one link and assistive technology that provides users with link lists for a web page do not include duplicate links.</p>
<p>Sometimes the text and the icon link are rendered in separate, adjacent table cells to facilitate page layout. Although WCAG 2 does not prohibit the use of layout tables, CSS-based layouts are recommended in order to retain the defined semantic meaning of the HTML table elements and to conform to the coding practice of separating presentation from content. If CSS is used, this technique can be applied to combine the links.</p>
<p>Sometimes the text and the icon link are rendered in separate, adjacent table cells to facilitate page layout. Although WCAG 2 does not prohibit the use of layout tables, <abbr title="Cascading Style Sheets">CSS</abbr>-based layouts are recommended in order to retain the defined semantic meaning of the HTML table elements and to conform to the coding practice of separating presentation from content. If CSS is used, this technique can be applied to combine the links.</p>
</section>
<section id="examples">
<h2>Examples</h2>
<section class="example">

<p>The icon and text are contained in the same <code class="language-html">a</code> element.</p>

<pre xml:space="preserve"> &lt;a href="products.html"&gt;
&lt;img src="icon.gif" alt=""&gt;
Products page
&lt;/a&gt;</pre>
<pre><code class="language-html">&lt;a href="products.html"&gt;
&lt;img src="icon.gif" alt=""&gt;Products page
&lt;/a&gt;</code></pre>
</section>
<section class="example">
<p>A link contains an icon and text, and the site help refers to the icon. The <code class="language-html">img</code> has a text alternative which is the name used for the icon in the site help, which describes clicking the home page icon.</p>

<p>A link contains an icon and text, and the site help refers to the icon. The
<code class="language-html">img</code> has a text alternative which is the name used for the icon in the
site help, which describes clicking the home page icon.</p>

<pre xml:space="preserve">&lt;a href="home.html"&gt;
&lt;img src="house.gif" alt="home page icon"&gt;
Go to the home page
&lt;/a&gt;</pre>
<pre xml:space="preserve"><code class="language-html">&lt;a href="home.html"&gt;
&lt;img src="house.gif" alt="home page icon"&gt;Go to the home page
&lt;/a&gt;</code></pre>
</section>
</section>
<section id="tests">
Expand Down
35 changes: 16 additions & 19 deletions techniques/html/H24.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>Providing text alternatives for the <code class="language-html">area</code>
</section>
<section id="applicability">
<h2>When to Use</h2>
<p>HTML documents that contain <code class="language-html">area</code> elements.</p>
<p><abbr title="HyperText Markup Language">HTML</abbr> documents that contain <code class="language-html">area</code> elements.</p>
</section>
<section id="description">
<h2>Description</h2>
Expand All @@ -29,15 +29,12 @@ <h2>Examples</h2>
<section class="example">
<p>This example uses the <code class="language-html">alt</code> attribute of the <code class="language-html">area</code> element to provide text that describes the purpose of the image map areas.</p>

<pre xml:space="preserve">&lt;img src="welcome.gif" usemap="#map1"
alt="Areas in the library. Select an area for
more information on that area."&gt;
<pre><code class="language-html">&lt;img src="welcome.gif" usemap="#map1"
alt="Areas in the library. Select an area for more information on that area."&gt;
&lt;map id="map1" name="map1"&gt;
&lt;area shape="rect" coords="0,0,30,30"
href="reference.html" alt="Reference"&gt;
&lt;area shape="rect" coords="34,34,100,100"
href="media.html" alt="Audio visual lab"&gt;
&lt;/map&gt;</pre>
&lt;area shape="rect" coords="0,0,30,30" href="reference.html" alt="Reference"&gt;
&lt;area shape="rect" coords="34,34,100,100" href="media.html" alt="Audio visual lab"&gt;
&lt;/map&gt;</code></pre>
</section>
</section>
<section id="tests">
Expand Down Expand Up @@ -68,13 +65,13 @@ <h2>Related Techniques</h2>
</section>
<section id="resources">
<h2>Resources</h2>
<ul>
<li>
<a href="https://html.spec.whatwg.org/multipage/image-maps.html#image-maps">HTML - Image maps</a>.
</li>
<li>
<a href="https://html.spec.whatwg.org/multipage/images.html#alt">HTML - Requirements for providing text to act as an alternative for images</a>.
</li>
</ul>
</section></body></html>
<ul>
<li>
<a href="https://html.spec.whatwg.org/multipage/image-maps.html#image-maps">HTML - Image maps</a>.
</li>
<li>
<a href="https://html.spec.whatwg.org/multipage/images.html#alt">HTML - Requirements for providing text to act as an alternative for images</a>.
</li>
</ul>
</section>
</body></html>
7 changes: 3 additions & 4 deletions techniques/html/H25.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1>Providing a title using the title element</h1>
</section>
<section id="applicability">
<h2>When to Use</h2>
<p>HTML</p>
<p><abbr title="HyperText Markup Language">HTML</abbr></p>
</section>
<section id="description">
<h2>Description</h2>
Expand All @@ -25,15 +25,15 @@ <h2>Examples</h2>
<section class="example">
<p>This example defines a document's title.</p>

<pre xml:space="preserve">&lt;!doctype html&gt;
<pre><code class="language-html">&lt;!doctype html&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;The World Wide Web Consortium&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
...
&lt;/body&gt;
&lt;/html&gt;</pre>
&lt;/html&gt;</code></pre>
</section>
</section>
<section id="tests">
Expand Down Expand Up @@ -66,7 +66,6 @@ <h2>Resources</h2>
<a href="https://html.spec.whatwg.org/multipage/semantics.html#the-title-element">HTML - The <code class="language-html">title</code> element</a>.
</li>
</ul>

</section>
</body>
</html>
16 changes: 8 additions & 8 deletions techniques/html/H28.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,41 @@ <h1>Providing definitions for abbreviations by using the abbr element</h1>
</section>
<section id="applicability">
<h2>When to Use</h2>
<p>HTML</p>
<p><abbr title="HyperText Markup Language">HTML</abbr></p>
</section>

<section id="description">
<h2>Description</h2>
<p>The objective of this technique is to provide expansions or definitions for
abbreviations by using the <code class="el">abbr</code> element. It is always appropriate to use the <code class="language-html">abbr</code> element for any abbreviation, including acronyms and initialisms.</p>
abbreviations by using the <code class="language-html">abbr</code> element. It is always appropriate to use the <code class="language-html">abbr</code> element for any abbreviation, including acronyms and initialisms.</p>
</section>

<section id="examples">
<h2>Examples</h2>
<section class="example">
<h3>Using <code class="language-html">abbr</code> element to expand abbreviations</h3>
<pre xml:space="preserve">&lt;p&gt;Sugar is commonly sold in 5 &lt;abbr title="pound"&gt;lb.&lt;/abbr&gt; bags.&lt;/p&gt;
&lt;p&gt;Welcome to the &lt;abbr title="World Wide Web"&gt;WWW&lt;/abbr&gt;!&lt;/p&gt;</pre>
<pre><code class="language-html">&lt;p&gt;Sugar is commonly sold in 5 &lt;abbr title="pound"&gt;lb.&lt;/abbr&gt; bags.&lt;/p&gt;
&lt;p&gt;Welcome to the &lt;abbr title="World Wide Web"&gt;WWW&lt;/abbr&gt;!&lt;/p&gt;</code></pre>
</section>

<section class="example">
<h3>Using <code class="language-html">dfn</code> and <code class="language-html">abbr</code> element to define abbreviations</h3>
<pre xml:space="preserve">&lt;p&gt;Tasini
<pre><code class="language-html">&lt;p&gt;Tasini
&lt;dfn id="etal"&gt;&lt;abbr title="and others"&gt;et al.&lt;/abbr&gt;&lt;/dfn&gt;
&lt;abbr title="versus"&gt;v.&lt;/abbr&gt;
The New York Times &lt;abbr title="and others"&gt;et al.&lt;/abbr&gt; is the landmark lawsuit
brought by members of the National Writers Union against ...
&lt;/p&gt;</pre>
&lt;/p&gt;</code></pre>
</section>

<section class="example">
<h3>Using the <code class="language-html">abbr</code> element to expand an acronym</h3>
<pre xml:space="preserve">&lt;p&gt;The use of &lt;abbr title="Keep It Simple Stupid"&gt;KISS&lt;/abbr&gt; became popular in ...&lt;/p&gt;</pre>
<pre><code class="language-html">&lt;p&gt;Recent updates to the &lt;abbr title="Cascading Style Sheets"&gt;CSS&lt;/abbr&gt; color module ...&lt;/p&gt;</code></pre>
</section>

<section class="example">
<h3> Using the <code class="language-html">abbr</code> element to expand an initialism</h3>
<pre xml:space="preserve"> &lt;p&gt;&lt;abbr title="British Broadcasting Corporation"&gt;BBC&lt;/abbr&gt;&lt;/p&gt;</pre>
<pre><code class="language-html">&lt;p&gt;&lt;abbr title="British Broadcasting Corporation"&gt;BBC&lt;/abbr&gt;&lt;/p&gt;</code></pre>
</section>

</section>
Expand Down
Loading