fix(#4001): preserve inline code inside markdown link labels
This commit is contained in:
1 parent
8669b6b8b5
commit
e3765a389c
2 files changed
+33
-1
No files matched your search
@@ -0,0 +1,22 @@
|
||||
from tests.test_renderer_js_behaviour import _render, driver_path # noqa: F401
|
||||
|
||||
|
||||
def test_inline_code_inside_link_label_renders_as_code(driver_path):
|
||||
out = _render(driver_path, "[`8c64957`](https://github.com/x/y)")
|
||||
assert '<a href="https://github.com/x/y"' in out
|
||||
assert "<code>8c64957</code>" in out
|
||||
assert "<code>" not in out
|
||||
|
||||
|
||||
def test_list_item_link_label_keeps_inline_code(driver_path):
|
||||
out = _render(driver_path, "- [`8c64957`](https://github.com/x/y)")
|
||||
assert "<li>" in out
|
||||
assert "<code>8c64957</code>" in out
|
||||
assert "<code>" not in out
|
||||
|
||||
|
||||
def test_unknown_raw_html_inside_link_label_is_escaped_once(driver_path):
|
||||
out = _render(driver_path, "[<script>alert(1)</script>](https://github.com/x/y)")
|
||||
assert "<script>" not in out
|
||||
assert "<script>alert(1)</script>" in out
|
||||
assert "&lt;script" not in out
|
||||
Reference in new issue
Block a user