-
Notifications
You must be signed in to change notification settings - Fork 13
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
Working with multiple source files w/ .cb.nb #45
Comments
I need to clarify the documentation on this. By default, when you pass Pandoc multiple files, it treats them all as one. Codebraid does the same thing, so the code from multiple files is treated as all being from one file, and thus all being in one session. Hence the error about first code cell config in the wrong place. Pandoc has a In terms of better errors: There's #24 for adding exit codes, and I'm referencing that here to remind myself to look into more extensive error messages on the command line as well. |
Thanks, I wasn't aware of this option.
I'm not sure yet if it's necessary - at this stage it seems there's enough flexibility to put together a sensible workflow without this feature, but I'll keep it in mind as I continue experimenting with multiple files.
👍 |
I recently experienced an issue with working with multiple source files that would then be combined into one larger document, e.g. multiple files representing book chapters. If the files are set up to run individually with the notebook executor (i.e.
.cb.nb
) then execution will fail silently when trying to execute and combine the files into a single document.Minimal reproducing example
Say you have two source files
ch1.md
andch2.md
that you want to execute+compile intobook.pdf
:Contents of
ch1.md
:Contents of
ch2.md
Executing/converting the files individually works as expected:
However, if you try to compile both documents into a single book, neither document is executed, though no warning or error are given on the command line:
In the latter case, if you look at the output
book.pdf
you will find an error printed:IMO it would be helpful to the user if this error were raised at the command line rather than (or in addition to being) embedded in the output document. In my actual use-case with much larger chapters, it was a very long time before I noticed this in the output book.
The error in
book.pdf
seems to suggest that the problem lies with the "special" metadatajupyter_kernel
, which is only supposed to be supplied in the first code cell. This suggests that an author would have to modify source file metadata if they wanted to switch between building individual chapters and the entire book. I hadn't noticed this mentioned in the docs before - if it's not there, then it would be an improvement if this behavior were documented.Perhaps this can be avoided if
.cb.run
is used instead of.cb.nb
? Is there a preferred way of using codebraid to have flexible outputs w/ multiple source files?The text was updated successfully, but these errors were encountered: