MCPcopy Index your code
hub / github.com/Python-Markdown/markdown / parse_hl_lines

Function parse_hl_lines

markdown/extensions/codehilite.py:42–54  ·  view source on GitHub ↗

Support our syntax for emphasizing certain lines of code. `expr` should be like '1 2' to emphasize lines 1 and 2 of a code block. Returns a list of integers, the line numbers to emphasize.

(expr: str)

Source from the content-addressed store, hash-verified

40
41
42def parse_hl_lines(expr: str) -> list[int]:
43 """Support our syntax for emphasizing certain lines of code.
44
45 `expr` should be like '1 2' to emphasize lines 1 and 2 of a code block.
46 Returns a list of integers, the line numbers to emphasize.
47 """
48 if not expr:
49 return []
50
51 try:
52 return list(map(int, expr.split()))
53 except ValueError: # pragma: no cover
54 return []
55
56
57# ------------------ The Main CodeHilite Class ----------------------

Callers 3

runMethod · 0.85
handle_attrsMethod · 0.85
_parseHeaderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…