-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Losing text when (semi)colons follow links. #229
Comments
I've been playing with this and I've noticed that colons trigger the same problem but other punctuation marks seem to be okay. There is some interaction between colons and brackets that I can't quite figure out. It looks like everything from the closing bracket to the (semi)colon disappears, at least until another closing bracket appears.
|
pcraig3
added a commit
to pcraig3/django-markdown-editor
that referenced
this issue
Feb 21, 2024
The issue with the current implementation seems to stem from the regex pattern mistakenly capturing and modifying links that should be left untouched, especially when they contain colons (:) or semicolons (;) that are part of a normal URL or anchor reference (#). This was leading to issues where text would be lost where a paragraph would contain more than one link and a semi-colon. eg: - for this input: - Citation 4. [footnote 4](#ftnt4) Citation 5. [footnote 5](#ftnt5) Citation 6; [footnote 6](#ftnt6) - we were getting this output: - <p>Citation 4. <a href="#ftnt4">footnote 4</a> Citation 5. <a href=";">footnote 5</a></p> - when what we wanted was this: - <p>Citation 4. <a href="#ftnt4">footnote 4</a> Citation 5. <a href="#ftnt5">footnote 5</a> Citation 6; <a href="#ftnt6">footnote 6</a></p> This PR fixes this so that regular links are preserved, but keeps in place the logic stripping bad protocols. Closes this issue: - agusmakmun#229
pcraig3
added a commit
to pcraig3/django-markdown-editor
that referenced
this issue
Feb 21, 2024
The issue with the current implementation seems to stem from the regex pattern mistakenly capturing and modifying links that should be left untouched, especially when they contain colons (:) or semicolons (;) that are part of a normal URL or anchor reference (#). This was leading to issues where text would be lost where a paragraph would contain more than one link and a semi-colon. eg: - for this input: - Citation 4. [footnote 4](#ftnt4) Citation 5. [footnote 5](#ftnt5) Citation 6; [footnote 6](#ftnt6) - we were getting this output: - <p>Citation 4. <a href="#ftnt4">footnote 4</a> Citation 5. <a href=";">footnote 5</a></p> - when what we wanted was this: - <p>Citation 4. <a href="#ftnt4">footnote 4</a> Citation 5. <a href="#ftnt5">footnote 5</a> Citation 6; <a href="#ftnt6">footnote 6</a></p> This PR fixes this so that regular links are preserved, but keeps in place the logic stripping bad protocols. Closes this issue: - agusmakmun#229
pcraig3
added a commit
to HHS/simpler-grants-pdf-builder
that referenced
this issue
Feb 27, 2024
The regex was stripping links when there were multiple links in a paragraph, including a colon or a semi colon. Here is the issue I raised about it: - agusmakmun/django-markdown-editor#229 Here is the fix I made: - pcraig3/django-markdown-editor@9d78dd0 If you want more info, it's pretty well explained in there.
This is issue is resolved in the newest version. #232 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there,
First of all, great library. It's been helping a ton as I'm working on a project to import large documents into an editable web interface.
However, I've recently stumbled across a bug that I'm not sure how to account for. Some of the text is just disappearing even though it is visible in the markdown preview.
Essentially, when I have a paragraph that contains two or more links, putting a colon or a semicolon in the sentence after the first link seems to completely drop everything after the first link. Here is a video of the behaviour I am seeing.
Details
Steps to reproduce
You can use this sentence to test the behaviour:
Citation 3 is visible in the "editor" view but missing in the "preview" view. If you move the semicolon to somewhere in "Citation 2", then it will disappear citations 2 and 3.
The text was updated successfully, but these errors were encountered: