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 "world" in html or "world" in html def test_markdown_fenced_code() -> None: html = markdown_html_fragment("```\n1 + 1\n```") assert "
" in html and "" 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
def test_markdown_image_wrapped_for_fullsize_link() -> None:
html = markdown_html_fragment("")
assert "imwald-fullimg" in html
assert "https://example.com/wide.png" in html
assert "![]()