gitlocalize / feedback

:mega: We love feedback :sparkles:
20 stars 8 forks source link

[BUG] links with special characters break after translation #120

Open mtdvlpr opened 1 year ago

mtdvlpr commented 1 year ago

Summary

I have a link in my bug-feature.md file with liquid code: [GitHub Discussions]({{site.github}}/discussions).

When the bug-feature.md gets translated through Gitlocalize, it changes the link to: [GitHub Discussions](%7B%7Bsite.github%7D%7D/discussions). This breaks my links, which is pretty annoying if I have to manually fix it everytime someone translates a page.

Steps to reproduce

Have a Markdown file with a link that uses the { or } chars. Translate it through Gitlocalize, make a PR and see the proposed changes.

Repository URL

https://gitlocalize.com/repo/8177

What is the current bug behavior?

Gitlocalize changes the { and } chars to its unicode

What is the expected correct behavior?

Gitlocalize should properly parse special characters inside links and not change them.

Relevant logs and/or screenshots

Screenshot from 2022-11-18 09-35-40

Possible fixes

(If you have any idea to solve the problem, please help us.)

svasilenkov commented 1 year ago

@mtdvlpr Thank you for reporting this! We'll try to find the way to keep urls the same as in the original file.

mtdvlpr commented 1 year ago

@svasilenkov, I now also noticed that greater than signs (>) are changed to >. This occurs everywhere in the file, not just in links. Could this also be fixed?

mtdvlpr commented 1 year ago

@svasilenkov, another one I just experiences: some special markup gets changed to html tags. Italic using _text_ gets transformed to <em data-md-type="emphasis">text</em> and the same thing happens to some code blocks and strong text.

svasilenkov commented 1 year ago

@mtdvlpr Could you please give us links to the files illustrating the problems?

mtdvlpr commented 1 year ago

This page has the generated code, em and strong blocks: https://github.com/mtdvlpr/meeting-media-manager/blob/gitlocalize-bugs/locales/pt/_posts/2022-08-17-configuration.md

mtdvlpr commented 1 year ago

This page has the > characters converted to &gt: https://github.com/mtdvlpr/meeting-media-manager/blob/gitlocalize-bugs/locales/nl/_posts/2022-08-17-present-media.md`

mtdvlpr commented 1 year ago

@svasilenkov, the problems mentioned above are not ideal, but also not breaking. The pages are correctly rendered. The original problem ({ and } converted into %7B and %7D) is a problem, because it breaks the links that are supposed to be generated based on variables. An example of that problem is the following file: https://github.com/mtdvlpr/meeting-media-manager/blob/gitlocalize-bugs/locales/nl/_posts/2022-08-17-bug-feature.md

svasilenkov commented 1 year ago

@mtdvlpr Thank you so much for the examples. I've added the issue in our todo list.