MCPcopy Create free account
hub / github.com/Python-Markdown/markdown / parse_hl_lines

Function parse_hl_lines

markdown/extensions/codehilite.py:43–55  ·  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

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