-
-
Notifications
You must be signed in to change notification settings - Fork 456
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
Turning on TrackTrivia prevents EmphasisInline elements being created #561
Comments
Just FYI, I have looked carefully at the code from NormalizeRenderer, and modified all my renderers to do what that does, and the output is now acceptable, although I would prefer it to match the input more exactly if possible. So the problem is no longer serious for me, but you might find it intriguing, and worth investigating, as it may be a bug in the parser. |
Note that |
Can you provide a minimally viable test that fails on your input and include assertion? That's go a long way in fixing this. |
I notice this as well, just using The code:
produces output:
If you remove the
|
Yeah, if |
I believe this should be fixed by 983187e and available in 0.28.0 Please note that I have opened a new issue #604 I would really highly suggest to not use Otherwise I'm curious about the use case for using |
I am trying to create a converter which will convert Markdown to a form suitable for posting Telegram messages. I have got quite far, to the extent that I can parse some markdown, and turn it into a text string, with MessageEntity objects which show the offset, length and attributes (e.g. a Url for a link) - which is how Telegram does formatting.
Unfortunately the text string has the "insignificant" white space removed - for instance, my first test markdown is:
I ran this through the Roundtrip renderer, and it came out as
Test stuff-bold text-italic text-~~strikethrough text~~-https://google.com?search=autolink-Full link-Bold full link-Bold full link
My telegram renderer (which removes the markdown furniture) shows the same.
My renderer is a subclass of RoundtripRenderer, which extracts the bold, italic and url elements, and finds these Entities:
I need to preserve the white space, so I tried setting EnableTrackTrivia in the parser.
Unfortunately the document then has no EmphasisInline elements in it. The roundtrip output is (correctly):
My Telegram renderer (which removes the markdown furniture for items it recognises) shows:
but most of the inline emphasis entities are missing:
Should TrackTrivia turn off recognising inline emphasis? If so, is there another way to retain the newlines and spaces in the original markdown?
The text was updated successfully, but these errors were encountered: