I know you can go to the files section of a PR and click to add a comment that references code. But is there any markdown or other method that lets you add a reference to some code in the replies to comments?
note: I mean referencing code from a file, not just pasting in the code. I'd like the code to update dynamically similar to code referenced when creating a comment with a file/line reference.
Here is a statement in Syntax guidance for basic Markdown usage: Note: Code attachments aren't permitted in PR comments
So I am afraid it is not support in Markdown.
You can try to click the "Copy link to this selection" option for a piece of code in a file and then insert the generated link into the comment reply to achieve the reference.
Related
On this pull request https://github.com/github/linguist/pull/3208 the Original Poster added some file search links for .nsi and .awk file types:
How did he do that? Is there some special syntax like #mention or user/repo#issue or he just did it the hard way:
[`.nsi` files](https://github.com/search?p=5&q=extension%3Ansi+if&ref=searchresults&type=Code&utf8=%E2%9C%93)
[`.awk` files](https://github.com/search?utf8=%E2%9C%93&q=extension%3Aawk+if&type=Code&ref=searchresults)
I'm not aware of any magic syntax for searches. Certainly nothing appears in the Mastering Markdown guide or the basic writing and formatting syntax page, though both describe user mentions, issue links, SHA links, etc.
I would speculate that the author of that comment performed a search in another tab, then copied the generated URL to their comment.
In a markdown file in a Gist, how do you quote some lines of code that are in a GitHub project?
If I was writing a Gist to try and explain how something works, I might have a block of text, then quote some code. I don't want to cut and paste the code in, I just want to quote some lines of code in a GitHub project. I am sure I have seen this done, but can't find an explanation of how to do it.
For example:
This algorithm makes use of Dijkstra's topological sort algorithm:
100: Result myFancyPantsAlgorithm(Blah blah) {
101: youGetTheIdea();
102: }
It is not possible to embed GitHub code snippets from Repositories.
What you might have seen is having a gist embedded in a "normal" website which is possible because GitHub provides a script to embed gists.
The script tag is (un)fortunately not whitelisted to be used in GitHub Flavored Markdown, so it is not possible to embed a gist in markdown.
A way to get around this would be to set a gh-page up, where you are able to embed a Gist as this SO-question shows. But then you're still not referencing to any live codebase.
So the answer to your question is: this is not possible, wether by embedding code from a repository nor by taking a detour via using gists.
I want to create a public gist in GitHub. I've been on YouTube and in Google search but have not found an answer to this question. And I don't see an answer in Stackoverflow to this question. This my seem trivial to some of you but I'm not so savvy in the tech world. I have a GitHub account. I did the tutorial in the Read Me Guide where I learned about repositories, branch, commit and pull request. I was in StackExchange chat room where someone asked me to make a public gist of my code that I was asking help with. Now I want to create a public gist of my code. On the Gist page I see a place to where I think the code is suppose to go. I see an Add File tab. But nothing happens when I click on it.The app won't let me just paste in my code. I see a place for a gist description. And I see a place for a file name including extension. But how do I place my code to create a public gist? Where does it go? Somebody help, please. After some more searching I think I got an answer. A Gist is just a repository. Am I right or wrong?
Assuming that you are logged in on GitHub:
Visit the Gist page
Paste your code in the text box directly underneath where it lets you set a file name;
Then press 'create public gist' in the bottom right.
For more information on this, visit the official docs.
If you want to create public gist repository on github then following steps are there,
There is a GithubHist(https://gist.github.com/) available to share you code publicly over the internet.
One of the advantage to use this is that when you create repository in GithubHist, one same repository will be created on https://bl.ocks.org
This will run your code and show output to the user.
Steps to use GithubHist
Login on Github.
There is a Gist option on top of then menu. Click on this.
It will redirect you on https://gist.github.com/
Here in Gist description give Title of your project.
Now create index.html file. This file runs by default when you go on https://bl.ocks.org with your repository location.
Now you can add as many files that you need in your project here.Just click on add file.
To add License,you need to add license.txt file and add contents of the license.
At last click on “Create public gist” or “Create Secret gist” option at bottom.
To add Background image of your project on https://bl.ocks.org
Get git clone of project to your local machine.
Create file with name “thumbnail.png” with dimension 230px * 120px.
Add this file to your project.
Commit and Push changes.
It’s Done now.
Check your Project with links
https://gist.github.com/yourName/ProjectId Source of project
https://bl.ocks.org/yourName/ProjectId output of project with source
Please see my blog on medium
https://medium.com/#thakkarchintu5/using-githubgist-on-github-f4f0944bbc80
also check gist repository that I have created
https://bl.ocks.org/ChandrakantThakkarDigiCorp
I wanted to create inline span of code that links to other page.
I want to use
`MongoCollection`
and
[MongoCollection](#http://php.net/manual/en/class.mongocollection.php)
together to make a link on a code element.
I tried
[`MongoCollection`](#http://php.net/manual/en/class.mongocollection.php)
and
`[MongoCollection](#http://php.net/manual/en/class.mongocollection.php)`
Both didn't work.
Is there any way to do that?
Could you explain a bit more about what you mean by inline span of code? This works in Github and links the MongoCollection link to the Mongo Collection php manual page.
[MongoCollection](http://php.net/manual/en/class.mongocollection.php)
Is that what you are looking for?
Is there a way I can remove a gist on GitHub? Created a gist earlier, but don't really want it there anymore.
Currently:
There's a "delete" button at the top of each gist now:
Previously...
Previously there was "delete this gist" link at the bottom of the gist's page, as below - thanks to Daniel Smith for pointing out in the comments below that this has been changed.
I created a tool which can help you delete multiple github gists both secret and public gists at once. https://gist-cleaner.ndolestudio.com
It's open source, you can find the source code here https://github.com/NdoleStudio/gist-cleaner