-
Notifications
You must be signed in to change notification settings - Fork 6
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
Converting Jira lists with CRLF line-breaks adds erroneous whitespace to subsequent text #25
Comments
Happy to try and find/fix the issue if it is not a trivial fix on your end. |
Hi @arctus-io! Thank you very much for the detailed issue with the reproducer. Sorry for the late response. I prepared a fix #28 Could you please test it? |
@catcombo: Thanks for the fix! I can confirm #28 fixes this issue. However... while testing this fix I noticed that the same type of issue regarding I can submit another issue with more details if needed but I believe applying an across the board change that gives My current workaround is to just convert all |
@arctus-io Thanks for the feedback! The easiest way to solve this problem is to replace |
from jira2markdown import convert
# Example for CRLF `\r\n` broken table conversion
table_CRLF_test_input = 'Table Test:\r\n\r\n||heading 1||heading 2||heading 3||\r\n|col A1|col A2|col A3|\r\n|col B1|col B2|col B3|\r\n\r\nLine after table'
table_CRLF_test_output = convert(table_CRLF_test_input)
print(f"\n\nJira Input with CRLF (printed):\n{'-' * 40}\n{table_CRLF_test_input}\n{'-' * 40}\n")
print(f"\n\nJira Input with CRLF (string):\n{'-' * 40}\n{repr(table_CRLF_test_input)}\n{'-' * 40}\n")
print(f"\n\nMarkdown Output from CRLF (printed):\n{'-' * 40}\n{table_CRLF_test_output}\n{'-' * 40}\n")
print(f"\n\nMarkdown Output from CRLF (string):\n{'-' * 40}\n{repr(table_CRLF_test_output)}\n{'-' * 40}\n")
# Example for LF `\n` working table conversion
table_LF_test_input = 'Table Test:\n\n||heading 1||heading 2||heading 3||\n|col A1|col A2|col A3|\n|col B1|col B2|col B3|\n\nLine after table'
table_LF_test_output = convert(table_LF_test_input)
print(f"\n\nJira Input with LF (printed):\n{'-' * 40}\n{table_LF_test_input}\n{'-' * 40}\n")
print(f"\n\nJira Input with LF (string):\n{'-' * 40}\n{repr(table_LF_test_input)}\n{'-' * 40}\n")
print(f"\n\nMarkdown Output from LF (printed):\n{'-' * 40}\n{table_LF_test_output}\n{'-' * 40}\n")
print(f"\n\nMarkdown Output from LF (string):\n{'-' * 40}\n{repr(table_LF_test_output)}\n{'-' * 40}\n") Output from above:
|
Thanks for the reproducer for tables! I guess the easiest and reliable way of how to fix this issue would be force conversion of |
When using
jira2markdown
'sconvert()
function on Jira lists with Carriage Return (CR) Line Feed (LF) (CRLF) style line-breaks the resulting markdown text adds erroneous whitespace to subsequent text after the last list item.See below for a visual example of the conversion issue.
Input (
jira_text
printed):Input (
jira_text
with line-breaks visualized):Expected Output (
md_text
printed):Expected Output (
md_text
with line-breaks visualized):Actual Output (
md_text
printed):Actual Output (
md_text
with line-breaks visualized):As shown the conversion ends up replacing:
\r\n
in the list with\n
\r\n\r\n
at the end of the list with\n \n
\r\n
after the list with\n
Copy-and-Pasteable Snippet to replicate the issue:
The text was updated successfully, but these errors were encountered: