-
Notifications
You must be signed in to change notification settings - Fork 434
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link Conversion Fails with Preceding or Following Square Brackets #552
Comments
Additional Context: Challenges with 'markdown-in-html' Extra and Dynamic ContentI attempted to use the 1. Unintended Conversions with Dynamic ContentWhen working with dynamic content, processing all HTML tags twice can lead to unexpected conversions. Specifically, there are instances where text that is meant to be included literally (as part of the text, not as Markdown) gets incorrectly converted into HTML. This unintended conversion distorts the intended output and complicates the handling of dynamic content. Example of Unintended Conversion IssueConsider the following Markdown input and its conversion process: Markdown Input: [before]
[Triggers of Alarm Systems](https://www.youtube.com/watch?v=aJOTlE1K90k&list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA&index=3)
[after] First Conversion to HTML: <p>[before]
[Triggers of Alarm Systems](https://www.youtube.com/watch?v=aJOTlE1K90k&list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA&index=3)
[after]</p> Adding Class for Markdown Processing: <p markdown="1">[before]
[Triggers of Alarm Systems](https://www.youtube.com/watch?v=aJOTlE1K90k&list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA&index=3)
[after]</p> 2. Inconsistent HTML Structure with Nested Paragraph TagsThe use of Example of Nested Paragraph Tag IssueAfter adding the class for Markdown processing, the output is: Processed HTML Output: <p>[before]
<p><a href="https://www.youtube.com/watch?v=aJOTlE1K90k&list=RDGMEMQ1dJ7wXfLlqCjwV0xfSNbA&index=3">Triggers of Alarm Systems</a></p>
[after]</p> Here, the link is wrapped in its own paragraph tag, creating a nested structure within the original paragraph tag. This is not inline and disrupts the intended flow and structure of the content. |
Fix incorrect parsing of links after square brackets (#552)
Were you referring to the
I believe the way this works internally is we take the text inside the tags and run the snippet through the markdown parser, which includes forming paragraphs. Not sure how we would avoid the nested paragraphs issue. We could turn off paragraph forming when |
Issue Description
I've encountered an issue with the markdown2 library where links are not properly converted to HTML when there are square brackets immediately before or after the link syntax. This issue disrupts the expected formatting and link functionality in the converted Markdown text.
Steps to Reproduce
Sample Python Code to Reproduce the Issue
The following Python code snippet can be used to reproduce the issue with the
markdown2
library:Expected Result
The link in the Markdown string should be converted into an HTML anchor tag, producing an output similar to:
Actual Result
The actual output keeps the Markdown link syntax without converting it into an HTML anchor tag:
This code snippet should help in replicating the issue for troubleshooting and resolving the problem.
Additional Context
This issue seems to be specific to cases where square brackets immediately surround the Markdown link syntax. Removing the surrounding square brackets results in correct HTML conversion.
The text was updated successfully, but these errors were encountered: