mirror of
https://github.com/basicmachines-co/basic-memory
synced 2026-06-21 13:47:35 +00:00
26 lines
739 B
Python
26 lines
739 B
Python
"""Test to explore markdown-it token structure."""
|
|
from textwrap import dedent
|
|
from markdown_it import MarkdownIt
|
|
|
|
def test_token_structure():
|
|
"""Analyze markdown-it token structure."""
|
|
content = dedent('''
|
|
# Title
|
|
|
|
## Observations
|
|
- [test] First line #tag
|
|
- [another] Second line #tag2
|
|
''')
|
|
|
|
md = MarkdownIt()
|
|
tokens = md.parse(content)
|
|
|
|
# Print full token structure
|
|
print("\nToken structure:")
|
|
for i, token in enumerate(tokens):
|
|
attrs = {key: getattr(token, key) for key in dir(token)
|
|
if not key.startswith('_') and not callable(getattr(token, key))}
|
|
print(f"\nToken {i}:")
|
|
for key, value in attrs.items():
|
|
print(f" {key}: {value!r}")
|