psalm / psalm-github-bot

ISC License
3 stars 5 forks source link

Don't add snippet if the link was in a quote #240

Open orklah opened 3 years ago

orklah commented 3 years ago

When a user quote a previous reply that contains a psalm.dev link, the bot will reply with links already posted. This should be a matter of checking if there's no ">" character on the beggining of the line

weirdan commented 3 years ago

Markdown blockquotes are a bit more complex

> Blockquote
line
can
be
   continued
   > up to three spaces are allowed before `>`
    > and four spaces make it a code block

The above is rendered as:

Blockquote line can be continued

up to three spaces are allowed before >

and four spaces make it a code block

So using a proper parser (e.g. commonmark.js) might be a better bet.

orklah commented 3 years ago

I had no idea this was this complex.

Not sure if it's a good idea anymore :D

weirdan commented 3 years ago

Another interesting case is footnote-style links, where the link reference might be in a quote, but the link URL is technically outside:

> Footnote [link][1]

[1]: https://example.org "Example Org"

Rendered as

Footnote link