ticket #86 attempt 1

This commit is contained in:
Typosaurus
2026-07-23 01:17:23 +00:00
parent ad1736ebf1
commit bfafe8c99d
4 changed files with 567 additions and 2 deletions
+40
View File
@@ -263,3 +263,43 @@ def test_xss_legitimate_link_survives_audit():
out = str(render_content("see https://example.com/page ok"))
assert 'href="https://example.com/page"' in out
assert_no_executable_html(out)
def test_url_inside_fenced_code_block_is_not_embedded():
out = str(render_content("```\nhttps://example.com/video.mp4\n```"))
assert "<pre" in out
assert "<video" not in out
assert "<iframe" not in out
assert "example.com/video.mp4" in out
def test_mention_does_not_match_email_address():
out = str(render_content("contact me at user@domain.com for info"))
assert "mention-link" not in out
assert "domain.com" in out
def test_bold_inside_inline_code_is_plain():
out = str(render_content("use `**not bold**` here"))
assert "<code>" in out
assert "<strong>" not in out
def test_consecutive_line_breaks_preserve_paragraphs():
out = str(render_content("line one\n\nline two\n\n\nline three"))
assert "<p>line one</p>" in out
assert "<p>line two</p>" in out
assert "<p>line three</p>" in out
def test_table_with_inline_links_renders_correctly():
out = str(render_content(
"| Name | Link |\n"
"|------|------|\n"
"| Dev | https://dev.place |\n"
"| Docs | https://docs.place |\n"
))
assert "<table>" in out
assert 'href="https://dev.place"' in out
assert 'href="https://docs.place"' in out
assert "<th" in out