Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 22

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.Aggregat...

 

What's wrong?

21 Replies
Highlighted
Community Manager
Message 2 of 22

Re: Embedding a code snippet broken?

Hi @agr,

 

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

Screen Shot 2018-03-12 at 7.29.28 AM.png

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

 

Thanks!

Highlighted
Copilot Lvl 2
Message 3 of 22

Re: Embedding a code snippet broken?

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

Highlighted
Ground Controller Lvl 1
Message 4 of 22

Re: Embedding a code snippet broken?

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?

Highlighted
Community Manager
Message 5 of 22

Re: Embedding a code snippet broken?

Hi @agr and @bartlangelaan,

 

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

 

Thanks!

Highlighted
Copilot Lvl 2
Message 6 of 22

Re: Embedding a code snippet broken?

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

Highlighted
Moderator
Message 7 of 22

Re: Embedding a code snippet broken?

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!

 

Mark helpful posts with Accept as Solution to help other users locate important info. Don't forget to give Kudos for great content!

Highlighted
Ground Controller Lvl 1
Message 8 of 22

Re: Embedding a code snippet broken?

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.

Highlighted
Ground Controller Lvl 1
Message 9 of 22

Re: Embedding a code snippet broken?

me too!

 

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

Highlighted
Copilot Lvl 2
Message 10 of 22

Re: Embedding a code snippet broken?

Seems like this is still broken