Skip to content
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

Emphasis in Markdown gives erroneous output in RichText #2974

Closed
jfjensen opened this issue May 14, 2022 · 9 comments
Closed

Emphasis in Markdown gives erroneous output in RichText #2974

jfjensen opened this issue May 14, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@jfjensen
Copy link

Describe the bug:

If I run the example code from #2589 and type in **hello** then no emphasis is added. The emphasis only appears when I add another *, which is obviously incorrect behavior.

The bug must be somewhere in the Markdown Renderer where the emphasis is handled.

To Reproduce:

Steps to reproduce the behaviour:

  1. Type in **hello** into the editor panel on the left. No emphasis is added.
  2. Then add another *.

Screenshots:

Screen Shot 05-13-22 at 10 40 PM

Device (please complete the following information):

  • OS: Windows 11Pro
  • Version: 10.0.22000
  • Go version: 1.17
  • Fyne version: v2.1.4
@jfjensen jfjensen added the unverified A bug that has been reported but not verified label May 14, 2022
@andydotxyz
Copy link
Member

Thanks for opening this, Apologies I did not notice it before commenting on the other thread where you mentioned this

@andydotxyz andydotxyz added bug Something isn't working and removed unverified A bug that has been reported but not verified labels May 15, 2022
@andydotxyz
Copy link
Member

Confirmed, thanks for reporting

@d4x1
Copy link
Contributor

d4x1 commented Jun 10, 2022

@jfjensen
This is caused by codes here, the codes here rewrite the bold style for emphasis elements.
I try to fix it like this, it works but breaks some test cases.

I cannot come up with an elegant way, I think markdownRenderer.Render must be implemented in a better way just like
html render in github.com/yuin/goldmark.

@andydotxyz do you have any advice?

@d4x1
Copy link
Contributor

d4x1 commented Jun 10, 2022

Or I can rewrite markdown render. Is this welcomed?

@jfjensen
Copy link
Author

@d4x1 Thanks for looking into this! Perhaps a total rewrite is indeed necessary?

@d4x1
Copy link
Contributor

d4x1 commented Jun 10, 2022

@d4x1 Thanks for looking into this! Perhaps a total rewrite is indeed necessary?

At least you can refer to my modification, it makes emphasis' behavior normal. :)

@andydotxyz
Copy link
Member

I cannot come up with an elegant way, I think markdownRenderer.Render must be implemented in a better way just like html render in github.com/yuin/goldmark.

@andydotxyz do you have any advice?

No specific thoughts. We always prefer smallest change possible - but some times the implementation was going down a blind alley. As long as there is no change to the RichText API we don't need to worry.

It's a naive stack implementation, but could certainly be better.
I think the main confusion is around paragraph vs block level text, so it is possible that a smaller fix may be OK

@andydotxyz
Copy link
Member

Maybe #3086 makes you a little happy? :)

@andydotxyz
Copy link
Member

Merged for v2.22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants