Skip to content

Commit 447429f

Browse files
authoredJul 22, 2020
Line Numbers: Improved documentation (#2456)
1 parent 3fcce6f commit 447429f

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed
 

‎plugins/line-numbers/index.html

+19-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,25 @@
2222
<h1>How to use</h1>
2323

2424
<p>Obviously, this is supposed to work only for code blocks (<code>&lt;pre>&lt;code></code>) and not for inline code.</p>
25-
<p>Add the <code>line-numbers</code> class to your desired <code>&lt;pre></code> or any of its ancestors, and the line-numbers plugin will take care of the rest. To give all code blocks line numbers, add the <code>line-numbers</code> class to the <code>&lt;body></code> of the page.</p>
25+
<p>Add the <code>line-numbers</code> class to your desired <code>&lt;pre></code> or any of its ancestors, and the Line Numbers plugin will take care of the rest. To give all code blocks line numbers, add the <code>line-numbers</code> class to the <code>&lt;body></code> of the page. This is part of a general activation mechanism where adding the <code>line-numbers</code> (or <code>no-line-numbers</code>) class to any element will enable (or disable) the Line Numbers plugin for all code blocks in that element. <br> Example:</p>
26+
27+
<pre><code>&lt;body class="line-number"> &lt;!-- enabled for the whole page -->
28+
29+
&lt;!-- with line numbers -->
30+
&lt;pre>&lt;code>...&lt;/code>&lt;/pre>
31+
&lt;!-- disabled for a specific element - without line numbers -->
32+
&lt;pre class="no-line-numbers">&lt;code>...&lt;/code>&lt;/pre>
33+
34+
&lt;div class="no-line-numbers"> &lt;!-- disabled for this subtree -->
35+
36+
&lt;!-- without line numbers -->
37+
&lt;pre>&lt;code>...&lt;/code>&lt;/pre>
38+
&lt;!-- enabled for a specific element - with line numbers -->
39+
&lt;pre class="line-number">&lt;code>...&lt;/code>&lt;/pre>
40+
41+
&lt;/div>
42+
&lt;/body></code></pre>
43+
2644
<p>Optional: You can specify the <code>data-start</code> (Number) attribute on the <code>&lt;pre></code> element. It will shift the line counter.</p>
2745
<p>Optional: To support multiline line numbers using soft wrap, apply the CSS <code>white-space: pre-line;</code> or <code>white-space: pre-wrap;</code> to your desired <code>&lt;pre></code>.</p>
2846
</section>

0 commit comments

Comments
 (0)
Please sign in to comment.