I want to display some lines of code on my website (created with GithubPages and Jekyll), extracted from a commit of my repository.
Example :
for some lines
https://github.com/fredericletellier/udacity-builditbigger/blob/6fe561a9e514de2e7175e2c16c5b3a1280223d2e/jokelib/src/main/java/com/joke/JokeProvider.java#L15-L22
for a diff of a specific file in a commit
https://github.com/fredericletellier/udacity-builditbigger/commit/6fe561a9e514de2e7175e2c16c5b3a1280223d2e?diff=unified#diff-6359bfff8a23dfc88d092acc996f6f97
But i need to quote a lot of code, and it is very long to copy-paste my code on gist. For the moment, i can provide a link to the interesting code.
Can i find a simple way to display this code in a snippet ?
UPDATE
If you have an another answer, you are welcome !
I found an answer : https://gist-it.appspot.com/
The first example, file on the latest version on a branch, should not be use.
When the code was changed, the snippet display something wrong. Prefer use the permalink to a file in a specific commit like in the second example : https://help.github.com/articles/getting-permanent-links-to-files/
The second example, a file or a part of a file in a specific version/commit :
<script src="http://gist-it.appspot.com/https://github.com/fredericletellier/udacity-builditbigger/blob/6fe561a9e514de2e7175e2c16c5b3a1280223d2e/jokelib/src/main/java/com/joke/JokeProvider.java?slice=14:22&footer=0"> </script>
Related
I'm trying to find the source for R14B05.
The reason is that I want to see how Precise Explanation of Typing Errors was implemented. That page provides a link to the source code, but it doens't seem to be version-controlled. So I want to diff against the code is based on in order to see what changed.
The page that links to the paper says that the code is based on R14B05, so now I'd like to try diffing against R14B05.
I look at https://github.com/erlang/otp/releases?after=OTP_R16B01_RC1 or git tag -l in the repo, I can only find R14B04, then the R15 series–no R14B05.
I see no R14B05 anywhere, only R14B01-R14B04.
http://erlang.org/download/ and http://erlang.org/documentation/ seems to have old files.
doc-5.8.5 is for Erlang/OTP R14B04, and the next one, which is doc-5.9, is for Erlang/OTP R15B. There does not appear to be a R14B05 one, so perhaps it indeed could be a typo. Perhaps they thought 5.8.5 was R14B05?
You could try contacting the authors as well, just in case.
I am working on this project : https://sbl.inria.fr/doc, where the documentation is done with doxygen.
We were used to define the id of our sections with the symbol "-" to separate the words, for example :
\section sec-intro Introduction
However, it looks like the convention has changed since doxygen 1.8.15-git and only alpha-numerical characters are accepted, breaking almost all the pages in our documentation.
Unfortunately, we have a large number of pages, and before reviewing the whole documentation, I wanted to know if there is anything that I am missing, like a doxygen option to turn ON / OFF
[edit]
Here is a minimal example that does not work for me, with doxygen 1.8.15-git:
/**
\mainpage My Main Page
Abstract
\section home-intro Introduction
Intro
*/
//! Documented class test
class test{
};
I just create the configuration file and then run doxygen on the directory containing my .hpp file (so that there is no need to specify the path to my header) :
doxygen -g; doxygen
The main page on the output html contains "Abstract", but not the section, and there is a warning in the doxygen log :
test.hpp:6: warning: Invalid section id `home'; ignoring section
[edit 2]
It worked with doxygen 1.8.14. I cloned the project from the git repository, so I had the latest version. Using the tag version for the 1.8.14, it works fine. I changed the title.
I found the cause of the problem, it is a regression on:
Bug 740046 - Negative sign in -Foo::Bar ruins hyperlink in generated output
The github issue causing the problem is https://github.com/doxygen/doxygen/pull/5677 and the pull request https://github.com/doxygen/doxygen/pull/704.
The issue has been fixed in the proposed patch: https://github.com/doxygen/doxygen/pull/6388
Using the GitHub API I'm looking for a way to generate a link to a specific line in a diff.
I can already contruct a "compare between commits" url, for example:
https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8
And visiting that url in a browser I can click on a specific line and I get this:
https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8#diff-21171d4ef87ca8e3591556dd18dfa456R26
However, I need to generate that last bit, the #diff-21171d4ef87ca8e3591556dd18dfa456R26 bit, programatically throught the github api, or else find another way of linking to the specific line in the diff without going through the browser.
Is this possible?
It is impossible.
I read https://developer.github.com/v3/repos/commits/#compare-two-commits
I tried
curl https://github.com/emmetog/feature-flags/compare/master...d8f9c29bfd0b87d26123b78b76feca8e4c87ad8
By using GitHub API, we can not specify what is the line 26th of different between new version and old version of file src/Emmetog/FeatureFlag/Entity/FeatureFlag.php
Because difference of 2 revisions doesn't happen at line 26, it is impossible for comparing. Or file src/Emmetog/FeatureFlag/Entity/FeatureFlag.php has only 10 lines of code, it is impossible for comparing.
In HTML webpage, id = diff-21171d4ef87ca8e3591556dd18dfa456R26 is auto-generated id. We can not specify intentional way before executing GitHub API request.
This may not be the best way to do it, but it looks like you can do some webscraping.
For example. In the link you provided. That line contains this element:
<td id="diff-21171d4ef87ca8e3591556dd18dfa456R26"
data-line-number="26" class="blob-num blob-num-addition
js-linkable-line-number selected-line"></td>
Which contains the diff hash. You also have the line number (26). Now you just need the 'R' between the diff hash and the line number. That, I believe, is given by whether the line has been added or removed. You can get that from the css class 'blob-num-addition'. It looks like 'blob-num-addition' corresponds to 'R' and 'blob-num-addition' corresponds to 'L'
Using Robohelp 10 html help. how can i map a topic from a merged (child) .chm to the master? User needs to press F1 and get the topic from the child .chm. I tried editing the Master's .ali file and changing the Alias entry, like this:
<Alias name="Test" link="child.chm::/test.htm">
Can't figure out the format to refer to the child.chm correctly. In the child or Master itself, if i use
<Alias name="Test" link="test.htm">
(assuming i put the actual .htm file inside that respective project and i'm not merging them, just testing with that single .chm), it works fine. I know the name parameter is correct, i just can't get the master to understand to look into the child to get the test.htm file. The old examples mention a redirect file, but how do i do that with this xml format? JUST LOOK AT THE EXAMPLES ROBOHELP MAKES WHEN YOU DEFINE A WORKING ONE, THEY ARE IN THE .ali file. Is that what i'm missing? YES Do i put the mapping into the child at all? NO
Defining context mappings Creating Context-Sensitive Help for Applications works fine in a standalone CHM, but in a merged help system one can run into problems when trying to open a Slave topic though the master CHM.
The process requires you to make changes to your map and alias files outside RoboHelp, and also to add a "redirector" topic to the master .chm file — so it is not straightforward.
Please see Context IDs in Merged Help.
So, you have to decide which one of the solutions is working for your needs.
Pete Lees mentioned some years ago "... that the HelpwareGroup.com site doesn't explain that the ALIAS section of the .hhp file must contain at least one bookmark-free reference to the redirect.htm file. If every redirect line in the section has a bookmark appended to it then the context help call will fail. So to fix the problem, add the following two lines to your .hhp file ...":
[ALIAS]
Dummy_Unused=redirect.htm
[MAP]
#define Dummy_Unused 0
How can I view the Markdown of a comment in a GitHub issue? For example, I would like to see the Markdown that makes up this comment:
https://github.com/jashkenas/backbone/issues/3857#issue-116738665
Simply replace username, reponame and issue number in the following url:
https://api.github.com/repos/USERNAME/REPONAME/issues/NUMBER/comments
Here's an example
First, the first post is the actual issue itself, not accessible but the GitHub issue API:
https://api.github.com/repos/jashkenas/backbone/issues/3857/comments
That list only 3 comments, since the first post is not a comment.
The issue itself has a formatted body:
https://api.github.com/repos/jashkenas/backbone/issues/3857
That returns:
"body": "In Safari , pass a path using unicode string to `navigate` method like this\r\n\r\n```js\r\nBackbone.history.navigate('/city/北京',{trigger:true});\r\n```\r\nThe hash is incorrect. It output\r\n\r\n```js\r\nlocation.hash\r\n//> #/city/%17%AC\r\n```\r\n\r\nI tracked the code, it caused by `_updateHash` method.\r\n\r\nThe call stack created by `History.prototype.navigate` method like this\r\n\r\n* navigate\r\n - decodeFragment\r\n - _updateHash\r\n\r\nThe fragment passed to `_updateHash`, was decoded by `decodeFragment`, so the hash was incorrect。\r\n\r\nI also searched the commit history, the `decodeFragment` added in \"1.2.0\"\r\n\r\nPS: My english is not good, although I am trying to improve\r\n\r\n",
That is not exactly mardown:
In Safari , pass a path using unicode string to `navigate` method like this
```js\r\nBackbone.history.navigate('/city/北京',{trigger:true});
```\r\nThe hash is incorrect. It output
```js\r\nlocation.hash
//> #/city/%17%AC
```
I tracked the code, it caused by `_updateHash` method.
The call stack created by `History.prototype.navigate` method like this
* navigate
- decodeFragment
- _updateHash
The fragment passed to `_updateHash`, was decoded by `decodeFragment`, so the hash was incorrect。
I also searched the commit history, the `decodeFragment` added in \"1.2.0\"
PS: My english is not good, although I am trying to improve
The second comment in this issue has two images, so those fancy effects are no markdow:
https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif
[https://jsfiddle.net/leexiaosi/uyp3o6ek/](https://jsfiddle.net/leexiaosi/uyp3o6ek/)
**notice!!!** : please open in safari.
### the record of safari
![safari](https://cloud.githubusercontent.com/assets/516562/11164567/62f9ddf6-8b2f-11e5-8aa8-631c1aa84422.gif)
### the record of chrome
![chrome](https://cloud.githubusercontent.com/assets/516562/11164583/c66d1b82-8b2f-11e5-9d88-ecba16ae6167.gif)
It's probably late. But I could somewhat do it this way (at least in firefox).
I am assuming your intention is to copy the formatting of the comment.
This is not an exact solution, but since GitHub supports HTML tags in comments, this will work just fine.
Right click somewhere at the top of the comment you want to copy.
Inspect element
In the Inspect Element box, you will find a line that's a few lines above the highlighted line which has this code:
<td class="d-block comment-body markdown-body js-comment-body">
Right click on the line having the above code
Select Copy>Inner HTML
Now you can either paste this in a comment box, preview it and you'll be able to see the same formatting, OR use an online HTML to MD converter.
You can see the raw markdown by using "Quote reply" (found after clicking three dots at top right of a comment.
Here's the beginning of the comment you asked for:
In Safari , pass a path using unicode string to navigate method like this
Backbone.history.navigate('/city/北京',{trigger:true});
The hash is incorrect. It output
location.hash
//> #/city/%17%AC
...