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

1.7 Unexpected character "&" in Page #3162

Closed
NicoHood opened this issue Jan 20, 2021 · 6 comments
Closed

1.7 Unexpected character "&" in Page #3162

NicoHood opened this issue Jan 20, 2021 · 6 comments
Assignees

Comments

@NicoHood
Copy link
Contributor

When using the following code (simplified) in my default.md using process.twig: true it fails:

[schreibe uns einfach eine Email.]({{ '/kontakt' }})

This worked with 1.6

@mahagr
Copy link
Member

mahagr commented Jan 20, 2021

Content of the parsed markdown is:

<p><a href="{{ &#039;/kontakt&#039; }}">schreibe uns einfach eine Email.</a></p>

@mahagr
Copy link
Member

mahagr commented Jan 20, 2021

This is actually the expected result in the new parsedown library. It escapes the links.

However... This is something we may want to detect and prevent from happening, content inside {{ ... }}, {% ... %} and {# ... #} should not be parsed if twig parsing is enabled and happens after Markdown has been converted to HTML.

@mahagr
Copy link
Member

mahagr commented Jan 20, 2021

@NicoHood Can you try out the fix?

@NicoHood
Copy link
Contributor Author

The fix works. It looks a bit hacky with the base64 though.

@mahagr
Copy link
Member

mahagr commented Jan 20, 2021

Well, the purpose was to hide the content from the Markdown parser. I thought first about just replacing certain characters, but then I thought that nothing inside twig should be seen as Markdown code:

{{ 'This is *My* text.'|markdown }}

as it could have crazy side effects. So I thought if I just make it to look text, there shouldn't be any issues. You can still use conditional statements and loops as only twig tags are being hidden.

@NicoHood
Copy link
Contributor Author

Alright, yeah I dont have any better idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants