mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Updated documentation for line highlighting
Co-authored-by: nh916 <26590757+nh916@users.noreply.github.com>
This commit is contained in:
parent
e897b89125
commit
1ff2aec06d
@ -358,6 +358,8 @@ argument placed right after the language shortcode. Note that line counts start
|
||||
at `1`, regardless of the starting line number specified as part of
|
||||
[`linenums`][Adding line numbers]:
|
||||
|
||||
=== "Lines"
|
||||
|
||||
```` markdown title="Code block with highlighted lines"
|
||||
``` py hl_lines="2 3"
|
||||
def bubble_sort(items):
|
||||
@ -380,6 +382,30 @@ def bubble_sort(items):
|
||||
|
||||
</div>
|
||||
|
||||
=== "Line ranges"
|
||||
|
||||
```` markdown title="Code block with highlighted line range"
|
||||
``` py hl_lines="3-5"
|
||||
def bubble_sort(items):
|
||||
for i in range(len(items)):
|
||||
for j in range(len(items) - 1 - i):
|
||||
if items[j] > items[j + 1]:
|
||||
items[j], items[j + 1] = items[j + 1], items[j]
|
||||
```
|
||||
````
|
||||
|
||||
<div class="result" markdown>
|
||||
|
||||
``` py linenums="1" hl_lines="3-5"
|
||||
def bubble_sort(items):
|
||||
for i in range(len(items)):
|
||||
for j in range(len(items) - 1 - i):
|
||||
if items[j] > items[j + 1]:
|
||||
items[j], items[j + 1] = items[j + 1], items[j]
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
[Adding line numbers]: #adding-line-numbers
|
||||
|
||||
### Highlighting inline code blocks
|
||||
|
Loading…
Reference in New Issue
Block a user