Embedding a code snippet broken?

Some time ago there was an announcement for the embedded code snippets and a help page that reiterates on the same topic and the feature worked for me in the past. But in last few weeks I had noticed that whenever I paste the lines permalink I end up just with a link text in the issue or comment verbatim, no code snippet inserted.

Did anything change regarding inserting code snippets with permalinks? Did it break for me only?

Example of the permalink I tried to insert:

https://github.com/NuGet/NuGet.Jobs/blob/5a85bee86431efb7173e3c0dd09f6ffdeefe7dfe/src/Stats.AggregateCdnDownloadsInGallery/Job.cs#L33-L36

What’s wrong?

12 Likes

Hi @agr,

When I use the permalink that you supplied, the embedded code seems to work for me:

If this is not what you’re seeing, I would recommend that you contact GitHub Support so they can directly troublehsoot your issue.

Thanks!

1 Like

Thanks. Yes, I that’s what I expect to see, but not what I am seeing. In my case link just stays as is. Will try contacting support.

Example isssue: https://github.com/agr/snippetpastetest/issues/1

I experience the same. I also only see a link instead of a code snippet when copy-pasting the link you provided.

Did you ever find out why it didn’t work for you?

Hi @agr and @bartlangelaan,

Where are you trying to insert the link? Are you putting it into a comment in the same repository?

Thanks!

Is it not possible to embed a code snippet that references a different repository than the one you’re commenting on?

5 Likes

Hi @kylebarron,

That is correct. Currently, this only works if you’re referencing a code snippet in the repository it lives in. From the Help documentation: “This type of permanent link will render as a code snippet only in the repository it originated in. In other repositories, the permalink code snippet will render as a URL.”

That said, I can definitely see the value in having this work across repositories. I’ll share this request internally. Though I can’t guarantee anything or share a timeline for this, I can tell you that it’s been shared with the appropriate teams for consideration.

Cheers!

23 Likes

I would also prefer for it to display a preview to other repositories. I also got confused and thought it was broken until I found this thread.

7 Likes

Seems like this is still broken

5 Likes

I still have this problem and referenced code snippet belongs to the same repository. Here is a reproduced case:

https://github.com/fals/cqrs-clean-eventual-consistency/issues/2

1 Like

I’m also seeing this issue.

Reproduced example:

https://github.com/simple-salesforce/simple-salesforce/issues/280

Doesn’t work for me either. Reproduced it in a sandbox repo.

I have the exact same problem in a private repo.

I got the same exact issue ! snippets don’t work!

Thanks everyone for writing in about this. We’re sorry for the trouble. This is due to an issue on our side that our team is aware of and working on. I don’t have an ETA on a fix right now but this is in good hands.

Thanks again for letting us know!

1 Like

This had been fixed for a while, but it’s now broken again. I thought I’d notify you in case you didn’t know already.

FWIW, same issue here.

Example: https://github.com/docsifyjs/docsify/issues/528

1 Like

me too!

(just writing random things to pass the 20 character limit)

Seems to be fixed. I personally made the mistake of embedding the URL as a link. You just need to paste it in and that’s it.

Seems still broken.