MCPcopy Create free account
hub / github.com/executablebooks/markdown-it-py / test_token_levels

Function test_token_levels

tests/test_linkify.py:4–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2
3
4def test_token_levels():
5 mdit = MarkdownIt(options_update={"linkify": True}).enable("linkify")
6 tokens = mdit.parse("www.python.org")
7 inline = tokens[1]
8 assert inline.type == "inline"
9 assert inline.children
10 link_open = inline.children[0]
11 assert link_open.type == "link_open"
12 link_text = inline.children[1]
13 assert link_text.type == "text"
14 link_close = inline.children[2]
15 assert link_close.type == "link_close"
16
17 # Assert that linkify tokens have correct nesting levels
18 assert link_open.level == 0
19 assert link_text.level == 1
20 assert link_close.level == 0

Callers

nothing calls this directly

Calls 3

MarkdownItClass · 0.90
enableMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…