Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sagecell with code hosted in GitHub

I would like to embed a Sage Cell in a webpage whose content comes from a GitHub .py file, so that changes in this file are immediately shown in the webpage. I have tried to use javascript / jquery like this (with the standard scripts in the head) and with some variations:

<div class="sage"><script type="text/x-sage" id="sage1"></script></div>
<script>$('#sage1').load("https://rawgit.com/path_to_the_file.py");</script>

and it sometimes work, but not always. I guess it has to do with the order of all the scripts involved in the process. Which would be the most appropiate and clean way to inject such code in a Sage Cell?

Sagecell with code hosted in GitHub

I would like to embed a Sage Cell in a webpage whose content comes from a GitHub .py file, so that changes in this file are immediately shown in the webpage. I have tried to use javascript / jquery like this (with the standard scripts in the head) and with some variations:

<div class="sage"><script type="text/x-sage" id="sage1"></script></div>
<script>$('#sage1').load("https://rawgit.com/path_to_the_file.py");</script>

and it sometimes work, but not always. I guess it has to do with the order of all the scripts involved in the process. Which would be the most appropiate and clean way to inject such code in a Sage Cell?

EDIT: I would like to show the input cell together with the input code, for educational purposes. So the content of the input cell has to be replaced with the content of the .py file.