Open JoseMezaMendieta opened 1 month ago
Thanks for reporting this, @JoseMezaMendieta , and welcome to fpdf2!
The equivalence to the escape backslash in Python is obviously not identical, as in our case it is supposed to always escape exactly two characters at a time instead of one. But of course it should not escape any longer sequence than that. Pinging the implementer @david-fed to see if he has a good idea how to fix this.
Or could we interest you in submitting a PR, @JoseMezaMendieta ?
I'd be interested in taking a crack at it! It'd be my first contribution if I can figure it out.
The equivalence to the escape backslash in Python is obviously not identical, as in our case it is supposed to always escape exactly two characters at a time instead of one. But of course it should not escape any longer sequence than that. Pinging the implementer @david-fed to see if he has a good idea how to fix this.
I just reported a similar problem in https://github.com/py-pdf/fpdf2/issues/1215#issuecomment-2296360896 😊
I did not see this issue from @JoseMezaMendieta beforehand (thank you for opening it 👍)
I think we should conform to the CommonMark standard regarding character escaping rules.
Error details The documentation says that the escape character "\" behaves in the same way that it generally does for Python. To my understanding, in Python the escape character only applies to 1 single instance immediately after the escape character. However, the escape character seems to be escaping multiple instances of special characters immediately after it. In the following code example, I am trying to escape the first instance of double asterisks, then enable bold, print the word in bold, disable bold, then print double asterisks again. All this should be done with no spaces in between, however, the output is not what was expected.
Minimal code Please include some minimal Python code reproducing your issue:
Expected output:
Actual output:
Environment Please provide the following information:
fpdf2
version used: fpdf2 @ git+https://github.com/py-pdf/fpdf2.git@e6a369d76e910dfb557478ef6e23d0b9d8392367