-
Notifications
You must be signed in to change notification settings - Fork 252
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
Markdown not escaping MD special characters #1215
Comments
Thanks for reporting this, and welcome to fpdf2, @exiva ! Well, the documentation doesn't promise that our markup parser would honor backslash escapes, so technically this isn't a bug... 😉 it is a perfectly valid feature request, though! |
If you want a head start, markdown markers are handled on fpdf Lines 3500 to 3515 in d574b07
|
Implemented in #1224 |
Hi. I'd like to reopen this issue to further discuss this. I may be mistaken, but the escaping implemented in PR #1224 does not seem to conform to the CommonMark standard. You can test the rendering of Escaping double underscores in Markdown should be done this way: What do you think @gmischler, @exiva & @david-fed? |
In "standard" markdown (including commonmark), escaping individual marker characters is necessary because both a single character as well as a double character sequence can act as a marker. In our own decidedly non-standard markdown implementation, all markers consist of double character sequences. This has the advantage of reducing conflicts with actual text, which is why I hope we'll stick to the concept for any future feature additions. It also means that it is fundamentally incompatible with every other markdown implementation out there (which could be seen both as an advantage or disadvantage). Added: The bug reported in #1236 obviously still needs to get fixed. |
I do not quite agree with that 🙂 Yes, you are right, currently our Markdown implementation is relatively limited and far from following any standard. However, I see several paths forward:
IMHO we should aim for option 1. or 2., but not for option 3., which is the least interesting for |
Given the fundamental conceptual incompabilities and the way we currently handle deprecated features (without a clear deprecation strategy/policy), this would take decades and they would never actually be the same. It is better to keep it clearly distinct from commonmark, to avoid the two getting confused.
|
In that comment I wrote:
😅 We already have some documentation on how to use a Markdown library combined with I'm really not sure that But I'm honestly curious to know what end-users think about it:
Maybe we could start a GitHub discussion poll about this. |
Ah, so I was overinterpreting your statements back then. Sorry for that. All the same, making our markdown implementation "more like commonmark" in any meaningful way would require to change the fundamental concept of its syntax: Namely to use double characters for all formatting markers. Given our general promise to stay backwards compatible, often at great cost, I don't see this as a viable option. So if we do want a more standard implementation (which essentially equals some flavour of commonmark), then there is no real alternative to adding it as an alternative in parallel. |
Error details
When using markdown in fpdf2 it should respect escaped characters like underscores and asterisks. It does not currently.
Minimal code
Please include some minimal Python code reproducing your issue:
Should output "This is a markdown test. Theres__double underscores" but outputs
Environment
Please provide the following information:
fpdf2
version used: 2.7.9The text was updated successfully, but these errors were encountered: