go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.52k stars 5.44k forks source link

Markdown escaping problem #2260

Open michaelkuhn opened 7 years ago

michaelkuhn commented 7 years ago

Description

Escaping short links ([[link]]) does not work at the moment. Even if I type \[\[link\]\], Gitea still converts it into a link.

This is probably due to how Markdown is handled in markdown.go:

result := RenderRaw(rawBytes, urlPrefix, isWikiMarkdown)
result = PostProcess(result, urlPrefix, metas, isWikiMarkdown)

RenderRaw seems to remove the escaping backslashes, PostProcess then only sees a normal short link. Switching the order of the calls is also problematic because PostProcess converts links that it should not (for example, https://pthree.org/2012/04/17/install-zfs-on-debian-gnulinux/ is recognized as an issue link due to the numbers).

jeromelebleu commented 7 years ago

Is #2168 can be related to this bug in a way? Or could this issue help to resolve it - or at least opens the discussion of the way to go? In my opinion, we should not have to escape short links in a code block...

Thanks in advance!

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

michaelkuhn commented 5 years ago

FYI: This still happens with Gitea 1.7.

schmittlauch commented 4 years ago

I just ran into this when trying to escape backticks inside a shell command, so they're getting displayed inside an inline code sample:

`foo=\`pwd\`/bin`
lafriks commented 4 years ago

@schmittlauch that is different, to to use backtick in code you should use:

``foo=`pwd`/bin``
silkentrance commented 3 months ago

with 1.21.11 you can use

\[[[woo]]

which renders as

[[woo]]

if you'd used

\[[woo]]

then it would render as

[woo]]

so there is still some bug in there somewhere