GitHub Code

AI Tools

Embed code from GitHub repository right into DeveloperHub. This allows you to keep code in the docs synced with changes in the repository.

To create GitHub Code block:

  • Start a new line (using )

  • Click on to open the blocks menu.

  • Select GitHub Code .

  • Paste in the box the URL of the GitHub file, for example: https://github.com/torvalds/linux/blob/master/kernel/signal.c.

You can also only embed a few lines by selecting the lines on GitHub, such a URL would show: https://github.com/torvalds/linux/blob/master/kernel/signal.c#L15-L29.

The file selected will be rendered as:

  • Markdown if the file name ends in .md.

  • Jupyter notebook if the file name ends in .ipynb.

  • Raw file otherwise.

Embedding is powered by https://emgithub.com/. You can change the code theme using advanced settings by modifying code.githubTheme.

Example GitHub Code

Source: https://github.com/torvalds/linux/blob/master/kernel/signal.c#L152-L170.

* We must never clear the flag in another thread, or in current
* when it's possible the current syscall is returning -ERESTART*.
* So we don't clear it here, and only callers who know they should do.
*/
return false;
}
void recalc_sigpending(void)
{
if (!recalc_sigpending_tsk(current) && !freezing(current)) {
if (unlikely(test_thread_flag(TIF_SIGPENDING)))
clear_thread_flag(TIF_SIGPENDING);
}
}
EXPORT_SYMBOL(recalc_sigpending);
void calculate_sigpending(void)
{
/* Have any signals or users of TIF_SIGPENDING been delayed
view raw kernel/signal.c delivered with ❤ by emgithub


  Last updated by Zaid
blocks