MCPcopy
hub / github.com/mkdocs/mkdocs / get_toc

Function get_toc

mkdocs/structure/toc.py:20–25  ·  view source on GitHub ↗
(toc_tokens: list[_TocToken])

Source from the content-addressed store, hash-verified

18
19
20def get_toc(toc_tokens: list[_TocToken]) -> TableOfContents:
21 toc = [_parse_toc_token(i) for i in toc_tokens]
22 # For the table of contents, always mark the first element as active
23 if len(toc):
24 toc[0].active = True # type: ignore[attr-defined]
25 return TableOfContents(toc)
26
27
28class AnchorLink:

Callers 14

renderMethod · 0.90
test_find_toc_by_idMethod · 0.90
test_pageMethod · 0.90
test_indented_tocMethod · 0.90
test_flat_tocMethod · 0.90
test_flat_h2_tocMethod · 0.90
test_mixed_tocMethod · 0.90
test_mixed_htmlMethod · 0.90
test_nested_anchorMethod · 0.90
test_entityrefMethod · 0.90

Calls 2

_parse_toc_tokenFunction · 0.85
TableOfContentsClass · 0.85

Tested by 13

test_find_toc_by_idMethod · 0.72
test_pageMethod · 0.72
test_indented_tocMethod · 0.72
test_flat_tocMethod · 0.72
test_flat_h2_tocMethod · 0.72
test_mixed_tocMethod · 0.72
test_mixed_htmlMethod · 0.72
test_nested_anchorMethod · 0.72
test_entityrefMethod · 0.72
test_charrefMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…