Skip to content

Code Listing #223

Answered by mmcky
lu-kas asked this question in Q&A
Jan 17, 2021 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

@lu-kas does the contents of that file need to be executable?

If not you can use the sphinx literalinclude directive to bring in the contents from a file (but this can't be used to bring in executable code just contents of files for viewing that may or may not need syntax highlighting)

```{literalinclude} <path-to-file>
```

We are working on support in jupyter-book to bring in code from a file through a :file: option to code-cell directives. It is currently in PR phase and not yet merged -- but it is coming. You can follow progress: executablebooks/MyST-NB#286

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@lu-kas
Comment options

@choldgraf
Comment options

Answer selected by lu-kas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants