-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python guide: include code examples using Jekyll #519
Comments
Gut feeling tells me that Jekyll appears to me a little to flexible with a potential for injection via variables. Haven't tried. |
Jekyll is run under the hood by GitHub when rendering the current guides. I run a test using my fork:
|
Signed-off-by: emcdtho <[email protected]>
Should the separate Python scripts necessarily be separate files, or could they be executable code chunks embedded within the guide itself? One of the options I have found for having executable Python code is using RMarkdown: https://rmarkdown.rstudio.com/ Alternatively, could Jupyter Notebook be a good alternative? This way we would have both the guide and the code examples in a singular file, which would prevent code duplication, while also being able to independently run the code examples. |
+1 for Jupyter Notebooks |
One objective of the Python guide is to provide executable code examples in separate Python scripts. At the same time, the code examples should also be shown in listings in the guide.
Problem: Markdown itself does not allow to include other files, i.e., such as the code examples.
Proposal: To avoid duplicating the code of the scripts in the markdown files, we can use Jekyll's
include_relate
primitive [1] to include the scripts in the rendered guide.Specifically, this pattern seems to work:
[1] https://jekyllrb.com/docs/includes/#including-files-relative-to-another-file
cc @myteron @tommcd
The text was updated successfully, but these errors were encountered: