You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
863 B
23 lines
863 B
from imwald.core.md_render import markdown_html_fragment, markdown_plain_summary, preprocess_standalone_image_urls |
|
|
|
|
|
def test_plain_summary_strips_markdown_noise() -> None: |
|
s = markdown_plain_summary("# Title\n\nHello **world**", max_len=80) |
|
assert "Title" in s and "world" in s |
|
assert "**" not in s and "#" not in s |
|
|
|
|
|
def test_markdown_renders_strong() -> None: |
|
html = markdown_html_fragment("Hello **world**") |
|
assert "<strong>world</strong>" in html or "<b>world</b>" in html |
|
|
|
|
|
def test_markdown_fenced_code() -> None: |
|
html = markdown_html_fragment("```\n1 + 1\n```") |
|
assert "<pre>" in html and "<code>" in html |
|
|
|
|
|
def test_preprocess_turns_bare_image_url_into_markdown_image() -> None: |
|
md = "hello\nhttps://example.com/x.png\nbye" |
|
out = preprocess_standalone_image_urls(md) |
|
assert "" in out
|
|
|