mirror of
https://github.com/google/styleguide.git
synced 2024-03-22 13:11:43 +08:00
Merge pull request #666 from tonyruscoe/gh-pages
Remove prettyprint from HTML/CSS Style Guide
This commit is contained in:
commit
106edd4b39
|
@ -31,25 +31,25 @@ quality is maintained.</p>
|
|||
files, style sheets, and scripts, unless the respective files are not available
|
||||
over HTTPS.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended: omits the protocol -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended: omits the protocol -->
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
|
||||
|
||||
<!-- Not recommended: uses HTTP -->
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended: omits the protocol */
|
||||
<pre><code class="language-css bad">/* Not recommended: omits the protocol */
|
||||
@import '//fonts.googleapis.com/css?family=Open+Sans';
|
||||
|
||||
/* Not recommended: uses HTTP */
|
||||
@import 'http://fonts.googleapis.com/css?family=Open+Sans';
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
@import 'https://fonts.googleapis.com/css?family=Open+Sans';
|
||||
</code></pre>
|
||||
|
||||
|
@ -61,13 +61,13 @@ over HTTPS.</p>
|
|||
|
||||
<p>Don’t use tabs or mix tabs and spaces for indentation.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint"><ul>
|
||||
<pre><code class="language-html good"><ul>
|
||||
<li>Fantastic
|
||||
<li>Great
|
||||
</ul>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">.example {
|
||||
<pre><code class="language-css good">.example {
|
||||
color: blue;
|
||||
}
|
||||
</code></pre>
|
||||
|
@ -80,19 +80,19 @@ over HTTPS.</p>
|
|||
attribute values (unless <code>text/CDATA</code>), CSS selectors, properties, and property
|
||||
values (with the exception of strings).</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<A HREF="/">Home</A>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<img src="google.png" alt="Google">
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
color: #E5E5E5;
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
color: #e5e5e5;
|
||||
</code></pre>
|
||||
|
||||
|
@ -102,11 +102,11 @@ color: #e5e5e5;
|
|||
|
||||
<p>Trailing white spaces are unnecessary and can complicate diffs.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<p>What?_
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<p>Yes please.
|
||||
</code></pre>
|
||||
|
||||
|
@ -149,11 +149,11 @@ depends on the project’s complexity.)</p>
|
|||
|
||||
<p>Append action items after a colon as in <code>TODO: action item</code>.</p>
|
||||
|
||||
<pre><code class="language-django prettyprint external">{# TODO(john.doe): revisit centering #}
|
||||
<pre><code class="language-django external good">{# TODO(john.doe): revisit centering #}
|
||||
<center>Test</center>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- TODO: remove optional tags -->
|
||||
<pre><code class="language-html good"><!-- TODO: remove optional tags -->
|
||||
<ul>
|
||||
<li>Apples</li>
|
||||
<li>Oranges</li>
|
||||
|
@ -194,12 +194,12 @@ to test.
|
|||
learning about technical requirements and constraints, and that ensures proper
|
||||
HTML usage.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<title>Test</title>
|
||||
<article>This is only a test.
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Test</title>
|
||||
|
@ -217,11 +217,11 @@ paragraphs, <code>a</code> elements for anchors, etc.</p>
|
|||
<p>Using HTML according to its purpose is important for accessibility, reuse, and
|
||||
code efficiency reasons.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<div onclick="goToRecommendations();">All recommendations</div>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<a href="recommendations/">All recommendations</a>
|
||||
</code></pre>
|
||||
|
||||
|
@ -241,11 +241,11 @@ may have no way of understanding what video or audio contents are about either.<
|
|||
whose purpose is purely decorative which you cannot immediately use CSS for, use
|
||||
no alternative text, as in <code>alt=""</code>.)</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<img src="spreadsheet.png">
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<img src="spreadsheet.png" alt="Spreadsheet screenshot.">
|
||||
</code></pre>
|
||||
|
||||
|
@ -268,7 +268,7 @@ sheets and scripts as possible from documents and templates.</p>
|
|||
maintenance reasons. It is always more expensive to change HTML documents and
|
||||
templates than it is to update style sheets and scripts.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<!DOCTYPE html>
|
||||
<title>HTML sucks</title>
|
||||
<link rel="stylesheet" href="base.css" media="screen">
|
||||
|
@ -281,7 +281,7 @@ templates than it is to update style sheets and scripts.</p>
|
|||
my website without doing everything all over again!</center>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<!DOCTYPE html>
|
||||
<title>My first CSS-only redesign</title>
|
||||
<link rel="stylesheet" href="default.css">
|
||||
|
@ -303,11 +303,11 @@ as well as among teams.</p>
|
|||
<p>The only exceptions apply to characters with special meaning in HTML (like <code><</code>
|
||||
and <code>&</code>) as well as control or “invisible” characters (like no-break spaces).</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
The currency symbol for the Euro is &ldquo;&eur;&rdquo;.
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
The currency symbol for the Euro is “€”.
|
||||
</code></pre>
|
||||
|
||||
|
@ -324,7 +324,7 @@ as it’s significantly different from what web developers are typically tau
|
|||
For consistency and simplicity reasons it’s best served omitting all optional
|
||||
tags, not just a selection.)</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -336,7 +336,7 @@ tags, not just a selection.)</p>
|
|||
</html>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<!DOCTYPE html>
|
||||
<title>Saving money, saving bytes</title>
|
||||
<p>Qed.
|
||||
|
@ -354,21 +354,21 @@ tags, not just a selection.)</p>
|
|||
and <a href="https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type"><code>text/javascript</code></a>
|
||||
as defaults. This can be safely done even for older browsers.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<link rel="stylesheet" href="https://www.google.com/css/maia.css"
|
||||
type="text/css">
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<link rel="stylesheet" href="https://www.google.com/css/maia.css">
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<script src="https://www.google.com/js/gweb/analytics/autotrack.js"
|
||||
type="text/javascript"></script>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<script src="https://www.google.com/js/gweb/analytics/autotrack.js"></script>
|
||||
</code></pre>
|
||||
|
||||
|
@ -389,19 +389,19 @@ on a new line.</p>
|
|||
put all <code>li</code> elements in one line. A linter is encouraged to throw a warning
|
||||
instead of an error.)</p>
|
||||
|
||||
<pre><code class="language-html prettyprint"><blockquote>
|
||||
<pre><code class="language-html good"><blockquote>
|
||||
<p><em>Space</em>, the final frontier.</p>
|
||||
</blockquote>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><ul>
|
||||
<pre><code class="language-html good"><ul>
|
||||
<li>Moe
|
||||
<li>Larry
|
||||
<li>Curly
|
||||
</ul>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><table>
|
||||
<pre><code class="language-html good"><table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Income
|
||||
|
@ -423,12 +423,12 @@ wrapping long lines if it significantly improves readability.</p>
|
|||
<p>When line-wrapping, each continuation line should be indented at least 4
|
||||
additional spaces from the original line.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint"><md-progress-circular md-mode="indeterminate" class="md-accent"
|
||||
<pre><code class="language-html good"><md-progress-circular md-mode="indeterminate" class="md-accent"
|
||||
ng-show="ctrl.loading" md-diameter="35">
|
||||
</md-progress-circular>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><md-progress-circular
|
||||
<pre><code class="language-html good"><md-progress-circular
|
||||
md-mode="indeterminate"
|
||||
class="md-accent"
|
||||
ng-show="ctrl.loading"
|
||||
|
@ -436,7 +436,7 @@ additional spaces from the original line.</p>
|
|||
</md-progress-circular>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><md-progress-circular md-mode="indeterminate"
|
||||
<pre><code class="language-html good"><md-progress-circular md-mode="indeterminate"
|
||||
class="md-accent"
|
||||
ng-show="ctrl.loading"
|
||||
md-diameter="35">
|
||||
|
@ -450,11 +450,11 @@ additional spaces from the original line.</p>
|
|||
<p>Use double (<code>""</code>) rather than single quotation marks (<code>''</code>) around attribute
|
||||
values.</p>
|
||||
|
||||
<pre><code class="language-html prettyprint badcode"><!-- Not recommended -->
|
||||
<pre><code class="language-html bad"><!-- Not recommended -->
|
||||
<a class='maia-button maia-button-secondary'>Sign in</a>
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-html prettyprint"><!-- Recommended -->
|
||||
<pre><code class="language-html good"><!-- Recommended -->
|
||||
<a class="maia-button maia-button-secondary">Sign in</a>
|
||||
</code></pre>
|
||||
|
||||
|
@ -495,7 +495,7 @@ meaning different from their siblings. They are typically needed as “helpe
|
|||
<p>Using functional or generic names reduces the probability of unnecessary
|
||||
document or template changes.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended: meaningless */
|
||||
<pre><code class="language-css bad">/* Not recommended: meaningless */
|
||||
#yee-1901 {}
|
||||
|
||||
/* Not recommended: presentational */
|
||||
|
@ -503,7 +503,7 @@ document or template changes.</p>
|
|||
.clear {}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended: specific */
|
||||
<pre><code class="language-css good">/* Recommended: specific */
|
||||
#gallery {}
|
||||
#login {}
|
||||
.video {}
|
||||
|
@ -522,12 +522,12 @@ document or template changes.</p>
|
|||
<p>Using ID and class names this way contributes to acceptable levels of
|
||||
understandability and code efficiency.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
#navigation {}
|
||||
.atr {}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
#nav {}
|
||||
.author {}
|
||||
</code></pre>
|
||||
|
@ -541,12 +541,12 @@ conjunction with IDs or classes.</p>
|
|||
|
||||
<p>Avoiding unnecessary ancestor selectors is useful for <a href="http://www.stevesouders.com/blog/2009/06/18/simplifying-css-selectors/">performance reasons</a>.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
ul#example {}
|
||||
div.error {}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
#example {}
|
||||
.error {}
|
||||
</code></pre>
|
||||
|
@ -561,7 +561,7 @@ where only one value is explicitly set.</p>
|
|||
|
||||
<p>Using shorthand properties is useful for code efficiency and understandability.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
border-top-style: none;
|
||||
font-family: palatino, georgia, serif;
|
||||
font-size: 100%;
|
||||
|
@ -572,7 +572,7 @@ padding-right: 1em;
|
|||
padding-top: 0;
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
border-top: 0;
|
||||
font: 100%/1.6 palatino, georgia, serif;
|
||||
padding: 0 1em 2em;
|
||||
|
@ -584,7 +584,7 @@ padding: 0 1em 2em;
|
|||
|
||||
<p>Do not use units after <code>0</code> values unless they are required.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">flex: 0px; /* This flex-basis component requires a unit. */
|
||||
<pre><code class="language-css good">flex: 0px; /* This flex-basis component requires a unit. */
|
||||
flex: 1 1 0px; /* Not ambiguous without the unit, but needed in IE11. */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
@ -596,7 +596,7 @@ padding: 0;
|
|||
|
||||
<p>Do not put <code>0</code>s in front of values or lengths between -1 and 1.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">font-size: .8em;
|
||||
<pre><code class="language-css good">font-size: .8em;
|
||||
</code></pre>
|
||||
|
||||
<h4 id="Hexadecimal_Notation">4.1.8 Hexadecimal Notation</h4>
|
||||
|
@ -606,11 +606,11 @@ padding: 0;
|
|||
<p>For color values that permit it, 3 character hexadecimal notation is shorter and
|
||||
more succinct.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
color: #eebbcc;
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
color: #ebc;
|
||||
</code></pre>
|
||||
|
||||
|
@ -625,7 +625,7 @@ unique identifiers followed by a dash.</p>
|
|||
<p>Using namespaces helps preventing naming conflicts and can make maintenance
|
||||
easier, for example in search and replace operations.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">.adw-help {} /* AdWords */
|
||||
<pre><code class="language-css good">.adw-help {} /* AdWords */
|
||||
#maia-note {} /* Maia */
|
||||
</code></pre>
|
||||
|
||||
|
@ -637,14 +637,14 @@ easier, for example in search and replace operations.</p>
|
|||
(including none at all) other than hyphens, in order to improve understanding
|
||||
and scannability.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended: does not separate the words “demo” and “image” */
|
||||
<pre><code class="language-css bad">/* Not recommended: does not separate the words “demo” and “image” */
|
||||
.demoimage {}
|
||||
|
||||
/* Not recommended: uses underscore instead of hyphen */
|
||||
.error_status {}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
#video-id {}
|
||||
.ads-sample {}
|
||||
</code></pre>
|
||||
|
@ -676,7 +676,7 @@ way that is easy to remember and maintain.</p>
|
|||
vendor-specific prefixes for a certain CSS property should be kept sorted (e.g.
|
||||
-moz prefix comes before -webkit).</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">background: fuchsia;
|
||||
<pre><code class="language-css good">background: fuchsia;
|
||||
border: 1px solid;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
|
@ -694,7 +694,7 @@ text-indent: 2em;
|
|||
that is rules within rules as well as declarations, so to reflect hierarchy and
|
||||
improve understanding.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">@media screen, projection {
|
||||
<pre><code class="language-css good">@media screen, projection {
|
||||
|
||||
html {
|
||||
background: #fff;
|
||||
|
@ -711,14 +711,14 @@ improve understanding.</p>
|
|||
<p>End every declaration with a semicolon for consistency and extensibility
|
||||
reasons.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
.test {
|
||||
display: block;
|
||||
height: 100px
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
.test {
|
||||
display: block;
|
||||
height: 100px;
|
||||
|
@ -732,13 +732,13 @@ reasons.</p>
|
|||
<p>Always use a single space between property and value (but no space between
|
||||
property and colon) for consistency reasons.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
h3 {
|
||||
font-weight:bold;
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
h3 {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ begins the <a href="https://www.w3.org/TR/CSS21/syndata.html#rule-sets">declarat
|
|||
<p>The opening brace should be on the same line as the last selector in a given
|
||||
rule.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended: missing space */
|
||||
<pre><code class="language-css bad">/* Not recommended: missing space */
|
||||
#video{
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ rule.</p>
|
|||
}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
#video {
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
@ -778,13 +778,13 @@ rule.</p>
|
|||
|
||||
<p>Always start a new line for each selector and declaration.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
a:focus, a:active {
|
||||
position: relative; top: 1px;
|
||||
}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
h1,
|
||||
h2,
|
||||
h3 {
|
||||
|
@ -799,7 +799,7 @@ h3 {
|
|||
|
||||
<p>Always put a blank line (two line breaks) between rules.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">html {
|
||||
<pre><code class="language-css good">html {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
|
@ -819,7 +819,7 @@ selectors and property values.</p>
|
|||
<p>Exception: If you do need to use the <code>@charset</code> rule, use double quotation
|
||||
marks—<a href="https://www.w3.org/TR/CSS21/syndata.html#charset">single quotation marks are not permitted</a>.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint badcode">/* Not recommended */
|
||||
<pre><code class="language-css bad">/* Not recommended */
|
||||
@import url("https://www.google.com/css/maia.css");
|
||||
|
||||
html {
|
||||
|
@ -827,7 +827,7 @@ html {
|
|||
}
|
||||
</code></pre>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Recommended */
|
||||
<pre><code class="language-css good">/* Recommended */
|
||||
@import url(https://www.google.com/css/maia.css);
|
||||
|
||||
html {
|
||||
|
@ -844,7 +844,7 @@ html {
|
|||
<p>If possible, group style sheet sections together by using comments. Separate
|
||||
sections with new lines.</p>
|
||||
|
||||
<pre><code class="language-css prettyprint">/* Header */
|
||||
<pre><code class="language-css good">/* Header */
|
||||
|
||||
#adw-header {}
|
||||
|
||||
|
|
|
@ -41,9 +41,12 @@ window.initStyleGuide = function(init) {
|
|||
// properly. Fix it by moving the code directly into the pre.
|
||||
find('pre > code', function(code) {
|
||||
var pre = code.parentElement;
|
||||
// internal TS style guide does not want prettyprint
|
||||
if (code.classList.contains("language-ts")) {
|
||||
code.classList.add("prettyprint");
|
||||
// Internal HTML/CSS & TS style guides do not use prettyprint.
|
||||
if (code.classList.contains('language-css') ||
|
||||
code.classList.contains('language-django') ||
|
||||
code.classList.contains('language-html') ||
|
||||
code.classList.contains('language-ts')) {
|
||||
code.classList.add('prettyprint');
|
||||
}
|
||||
pre.className = code.className;
|
||||
pre.innerHTML = code.innerHTML;
|
||||
|
|
Loading…
Reference in New Issue
Block a user