URL perfectly clickable from PieFed
PieFed W
that is not a W... i surrounded the URL with backticks, which means it should be treated as code and not made into a link.
cc: PyFedi developer @rimu@piefed.social
I had a glance at the source and don't see a very quick fix, but I think the solution involves getting rid of the auto-linkification here and instead have that be done by the markdown library. This issue indicates that the markdown library PyFedi is using is capable of doing that.
Here is a test I wrote which I think should pass which does not currently :)
diff --git a/tests/test_markdown_to_html.py b/tests/test_markdown_to_html.py
index 329b19be..108276c5 100644
***
a/tests/test_markdown_to_html.py
+++ b/tests/test_markdown_to_html.py
@@ -37,6 +37,12 @@ class TestMarkdownToHtml(unittest.TestCase):
result = markdown_to_html(markdown)
self.assertTrue("<pre><code>code block" in result)
+ def test_code_block_link(self):
+ """Test code blocks formatting containing a link"""
+ markdown = "```\ncode block with link: https://example.com/ \n```"
+ result = markdown_to_html(markdown)
+ self.assertEqual("<pre><code>code block with link: https://example.com/ ", result)
it currently produces this failure:
====================================================== FAILURES =======================================================
_______________________________________ TestMarkdownToHtml.test_code_block_link _______________________________________
self = <tests.test_markdown_to_html.TestMarkdownToHtml testMethod=test_code_block_link>
def test_code_block_link(self):
"""Test code blocks formatting containing a link"""
markdown = "```\ncode block with link: https://example.com/ \n```"
result = markdown_to_html(markdown)
> self.assertEqual("<pre><code>code block with link: https://example.com/ ", result)
E AssertionError: '<pre[24 chars]ink: https://example.com/ ' != '<pre[24 chars]ink: <a href="https://example.com/" rel="nofoll[61 chars]e>\n'
E - <pre><code>code block with link: https://example.com/
E + <pre><code>code block with link: <a href="https://example.com/" rel="nofollow ugc" target="_blank">https://example.com/</a>
E + </code></pre>
E +
tests/test_markdown_to_html.py:44: AssertionError
HTH, and thanks for writing free software!
