heraldofsolace / VimHelpBot

VimHelpBot is a bot that replies to r/vim and r/neovim comments with link to Vim Help page
GNU General Public License v3.0
46 stars 2 forks source link

Target link for `:help [` produces broken markdown link #47

Closed Gumnos closed 5 months ago

Gumnos commented 1 year ago

Describe the bug

Issuing :help [ produced a rendering issue with the bot's resulting markdown

To Reproduce

Steps to reproduce the behavior:

  1. Create a comment in /r/vim containing :help [

  2. Let the bot respond

Expected behavior

Expected a link to the corresponding help-target https://vimhelp.org/index.txt.html#%5B (which it found & created), but the Markdown of the link got messed up. See https://www.reddit.com/r/vim/comments/15lvgi2/what_commonly_used_vim_motionsthemesfeatures_do/jvd80or/

heraldofsolace commented 11 months ago

This is weird, because the bot definitely produces URL-encoded text. We already have tests for that. Maybe Reddit is changing the URL when posting. I will look into it

Gumnos commented 5 months ago

I'm getting a similar issue with ] in links as shown in this helpbot reply where the help-link for ]p seems to trigger breakage in the generated Markdown (it finds the correct help-target URL and uses that, just putting the "wrong" thing in the […]() bit of the link causing it to get misinterpreted). Both of these are in Old Reddit, FWIW.

Screenshot of rendered output hiccup

heraldofsolace commented 5 months ago

This seems to be the case for old Reddit only. In new Reddit it renders correctly. I think I can circumvent this problem by replacing the brackets with full width square brackets.

heraldofsolace commented 5 months ago

This is fixed now