-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1162 from akrabat/highlighting-improvements
Make the hl_lines directive work with plain text
- Loading branch information
Showing
4 changed files
with
36 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
Highlight lines | ||
--------------- | ||
|
||
The following code snippet should dim all lines that are not marked with | ||
The following code-blocks should dim all lines that are not marked with | ||
``hl_lines``, and so the effect is to highlight the selected lines | ||
|
||
With this block of plain text, lines 1 and 3 are dimmed: | ||
|
||
.. code-block:: text | ||
:linenos: | ||
:hl_lines: 2 | ||
To be | ||
or not to be | ||
that is the question | ||
For this block of Python, lines 1, 2, 4, 6, 8, 9 and 10 are dimmed: | ||
|
||
.. code-block:: python | ||
:linenos: | ||
:hl_lines: 3 5 6 | ||
:hl_lines: 3 5 7 | ||
number = 0 | ||
def f(): | ||
a = 1 | ||
b = 2 | ||
c = 3 | ||
d = 4 | ||
e = 5 | ||
f = 6 | ||
g = 7 | ||
if number > 0: | ||
print("Positive number") | ||
elif number == 0: | ||
print('Zero') | ||
else: | ||
print('Negative number') | ||
print('This statement is always executed') | ||
Binary file not shown.