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

Link text disappears if it contains inline code in it #2

Open
KEINOS opened this issue Jan 3, 2020 · 3 comments
Open

Link text disappears if it contains inline code in it #2

KEINOS opened this issue Jan 3, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@KEINOS
Copy link

KEINOS commented Jan 3, 2020

Thank you for providing us such a great, simple, nice and neat app!

It might be against Markdown's syntax rules but I found out that if the link ([]()) contains a word or phrase with enclosed backticks (`) in a "link text", the "link text" disappears.

$ cat sample.md
[`foo` bar](http://sample.com/)

[foo bar](http://sample.com/)

$ mdr sample.md
[](http://sample.com/)

[foo bar](http://sample.com/)

GitHub flavor markdown works tho: foo bar

  • Env info:
    • OS: macOS 10.14.6 (OSX Mojave), mdr: mdr_darwin_amd64 v0.2.1, CPU: Intel Core i5
    • OS: Raspbian 8.0 (Jessie), mdr: mdr_linux_arm v0.2.1, CPU: ARM v6l
@MichaelMure
Copy link
Owner

I think what happens is that I assumed that the "link text" would be well, a simple ast.Text. It seems that was too much to assume. Relevant code is there: https://github.com/MichaelMure/go-term-markdown/blob/master/renderer.go#L300-L312

Man, Markdown is complex.

@MichaelMure MichaelMure added the bug Something isn't working label Jan 3, 2020
@MichaelMure
Copy link
Owner

So I think the fix could be:

  • on entering ast.Link, print [
  • let whatever child node render in r.inlineAccumulator
  • on exiting, print the rest: ](....)

That could get messy though if it's possible to have an image there.

@KEINOS
Copy link
Author

KEINOS commented Jan 3, 2020

Thanks for the quick response!

Man, Markdown is complex.

I agree. Too many flavors.

I'm not a Gopher but thinking of recursive processing ... uh ... I can imagine how tough it would be.

I'm not in a rush. So please take your time. Thank you!

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

2 participants