summaryrefslogtreecommitdiffstats
path: root/tests/test_linkify.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:24:24 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:24:24 +0000
commit12e8343068b906f8b2afddc5569968a8a91fa5b0 (patch)
tree75cc5e05a4392ea0292251898f992a15a16b172b /tests/test_linkify.py
parentInitial commit. (diff)
downloadmarkdown-it-py-12e8343068b906f8b2afddc5569968a8a91fa5b0.tar.xz
markdown-it-py-12e8343068b906f8b2afddc5569968a8a91fa5b0.zip
Adding upstream version 2.1.0.upstream/2.1.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_linkify.py')
-rw-r--r--tests/test_linkify.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_linkify.py b/tests/test_linkify.py
new file mode 100644
index 0000000..96d506d
--- /dev/null
+++ b/tests/test_linkify.py
@@ -0,0 +1,19 @@
+from markdown_it import MarkdownIt
+
+
+def test_token_levels():
+ mdit = MarkdownIt(options_update={"linkify": True}).enable("linkify")
+ tokens = mdit.parse("www.python.org")
+ inline = tokens[1]
+ assert inline.type == "inline"
+ link_open = inline.children[0]
+ assert link_open.type == "link_open"
+ link_text = inline.children[1]
+ assert link_text.type == "text"
+ link_close = inline.children[2]
+ assert link_close.type == "link_close"
+
+ # Assert that linkify tokens have correct nesting levels
+ assert link_open.level == 0
+ assert link_text.level == 1
+ assert link_close.level == 0