-
Added support for Pandoc option
--embed-resources. -
Python 3.11 compatibility: set
PYDEVD_DISABLE_FILE_VALIDATION=1at beginning of command-line application to prevent debugger frozen modules warning. -
Switched packaging to
pyproject.toml. -
Added support for GAP (#51).
- Fixed bug in Pandoc version checking for Pandoc 3.0 compatibility.
-
Sessions that result in errors are now re-executed during subsequent builds regardless of whether the session code is modified. Previously, re-execution was only triggered by code modification. This addresses situations such as import errors due to missing libraries (#57).
-
Markup and code can now be displayed
raw. Previously, onlyverbatimwas permitted. -
Fixed a bug that caused Jupyter kernels to be used if there were any Jupyter settings in the YAML metadata, including
jupyter: false.
- Fixed a bug that prevented multi-file documents from working with input
formats other than Pandoc's Markdown (
markdown).
-
Added support for specifying document-wide settings in the YAML metadata. Codebraid settings must be under either a
codebraidorcodebraid_key in the metadata. Pandoc will ignorecodebraid_so it will not be available to filters; this distinction should not typically be important.To use Jupyter kernels automatically for all sessions, simply set
jupyter: true. For example,--- codebraid: jupyter: true ---It is also possible to set a default kernel and/or default timeout. For example,
--- codebraid: jupyter: kernel: python3 timeout: 120 ---A Jupyter kernel and/or timeout can still be set in the first code chunk for a given session, and will override the document-wide default.
It is also possible to set
live_output: <bool>in the metadata. Additional metadata settings will be added in future releases. -
When a selected Jupyter kernel is ambiguous (for example,
pythonon a machine with multiple Python kernels), there is no longer an error message by default. Instead, if all potential matches have kernel names that include a version number, and if only a single kernel has a version number higher than the rest, then the kernel with the highest version number is used. Only version numbers of the formmajor,major.minor, andmajor.minor.patchare considered in doing the comparison. Any alpha/beta/dev or similar status is ignored. -
Fixed an encoding bug that prevented
svgrich output from being displayed. Addedsvgto the collection of rich output formats that are automatically displayed (#53). -
stdout and stderr from Jupyter kernel processes are no longer included in Codebraid's stdout and stderr. Some kernels such as IJulia write messages to output streams during startup. This was causing error messages in Codebraid Preview and incorrect documents when Codebraid outputs to stdout.
-
Fixed a bug that prevented Jupyter kernels from being used when the kernel name, kernel display name, and kernel language were not all different from each other.
-
Setting
jupyter_timeoutwithoutjupyter_kernelon the first code chunk in a session now causes the session to execute with the default kernel for the session's language. Previously,jupyter_timeoutwas ignored withoutjupyter_kernel. -
Sessions that do not specify execution information (language, executable, Jupyter kernel, etc.) now result in an error message rather than causing
codebraidto exit with an error. -
Fixed
--only-code-outputbugs that affected Codebraid Preview..cb-pastedid not work due to a hashing bug. LaTeX rich output appeared verbatim instead of being interpreted. Verbatim textual rich output did not have the correct language class. Code chunks with a missing language or inherited language could have incorrect output when interspersed. -
Code chunks with a named session but an invalid command are now treated as session rather than source chunks. This provides better error messages and prevents execution of the named session since it involves errors.
-
Code chunks in sessions and sources with significant errors are now given consecutive line numbers, instead of all starting with a line number of 1.
-
Added option
--stdin-json-header, which treats the first line of stdin as a header in JSON format containing data about stdin such as file origin. This allows Codebraid Preview to transmit multiple, concatenated files via stdin while still getting correct file names and line numbers in error and warning messages, rather than a file name like<string>and a number based on concatenated file length. It also allows Codebraid Preview and normal Codebraid processing to share the same cache, since Codebraid can associate the cache with specific file paths rather than just generic stdin. -
Fixed a caching bug. Errors due to missing executables (built-in code execution system), missing Jupyter kernels, ambiguous Jupyter kernel names, and some Jupyter configuration issues were only reported during an initial Codebraid run. During subsequent runs with unmodified code and settings, errors were not reported and there was no attempt to re-execute sessions to check for newly available executables/Jupyter kernels/libraries.
-
When a Jupyter kernel name is ambiguous (for example,
pythonon a machine with multiple Python kernels), the error message now lists all potentially compatible kernels instead of just stating that a kernel could not be found. -
Improved
--only-code-output. It now sends anindexmessage that lists all code collections being processed and includes information about language inheritance throughcopy. Code chunkoutputmessages now include execution progress information for chunks being executed. Fixed a bug that could cause aKeyErrorfor some sessions containing only a single code chunk. Fixed a bug that caused the first code chunk in a code collection to be resent unnecessarily at the end of code collection processing. -
Refactored line number calculations. Fixed a bug that could produce incorrect line numbers for code from
copy. Fixed a bug with--only-code-outputthat duplicated line number settings for the first code chunk in a code collection when checking the code chunk for modifications at the end of code collection processing. -
Fixed a bug that skipped progress notifications for sessions with errors that prevent code execution. This prevented
--only-code-outputfrom sending information about these sessions and prevented summaries with--live-output. -
Fixed a bug that prevented a progress notification for session completion with the built-in code execution system.
-
Improved progress tracking for sources.
-
Improved process for setting the default Python executable used by the built-in code execution system. For
.pythoncode chunks in a session that does not setexecutableto a custom value, Python'ssys.executableis now used as the default Python executable if it is set and if it is equivalent to eitherpythonorpython3on PATH. This will typically guarantee that the Python interpreter runningcodebraidis identical to the default for built-in code execution. The default Python executable is now set using an absolute path when possible, to avoid name resolution issues under Windows with Python environments. -
Fixed a bug that stripped a trailing empty line from code blocks.
-
Fixed a bug that caused an incorrect
attr_hashin--only-code-outputwhen a code chunk has key-value attributes.
-
Added
--only-code-outputoption, which writes code output in JSON Lines format to stdout as soon as it is available, and does not create a document. This is intended for use with Codebraid Preview, so that document previews can be updated during code execution. -
Added command-line option
--no-executethat disables code execution and only uses available cached output. -
Added first-chunk setting
executable_optsfor passing command-line options to the executable that compiles/runs code (#52). -
Setting
executableto an executable relative to the working directory (for example,./exec.sh) now functions correctly. Previously,pathlib.Path()was used to track executables, but it strips a leading./. -
Added first-chunk setting
argsfor passing command-line arguments to executed code.
-
Python 3.7 is now the minimum supported version.
-
Added support for Codebraid Preview extension for VS Code, which provides an HTML preview with scroll sync and document export (#37). As part of this, added support for Pandoc's
commonmark_xas an input format.commonmark_xis CommonMark Markdown plus Pandoc extensions that give it most of the capabilities of Pandoc Markdown.commonmark_xdoes not support the full Pandoc Markdown syntax for classes, so it requires Codebraid commands in the form.cb-<command>instead of.cb.<command>(for example,.cb-runinstead of.cb.run)..cb-<command>is now supported for Pandoc Markdown as well and should be preferred going forward for maximum compatibility across Pandoc variants of Markdown..cb.<command>continues to be supported for Pandoc Markdown. -
Added fine-grained progress tracking and display of progress. When
codebraidruns in a terminal, there is now a color-coded summary of errors and warnings plus a progress bar. In a terminal,live_outputnow displays color-coded output from executed code in real time, including a summary of rich output.live_outputnow displays a summary of errors and warnings for all output loaded from cache.live_outputis now compatible with Jupyter kernels (#21).Added command-line option
--live-output. This changes the defaultlive_outputvalue for all sessions totrue(#21). -
Completely reimplemented error and warning handling to support new
live_outputfeatures and to provide better display of errors and stderr within documents. All errors and warnings related to code execution are now cached.At the end of document build,
codebraidnow exits with a non-zero exit code if there are errors or warnings (#24). This is triggered by using invalid settings or by executing code that causes errors or warnings. It is also triggered by loading cached output from code that caused errors or warnings when it was originally executed (error and warning state is cached). Exit codes are between 4 and 60 inclusive. The bits in the exit code are assigned value as follow:0b00<doc_warn><exec_warn><doc_error><exec_error>00Nonzero values for
<doc_warn>and<exec_warn>indicate the presence of warnings from document build and from code execution, respectively.<doc_error>represents an error in document build that was not so severe that build was canceled with exit code 1, such as invalid settings related to displaying code output.<exec_error>represents an error from code execution. An exit code of 1 still indicates thatcodebraiditself exited unexpectedly or otherwise failed to complete document build. -
Reimplemented built-in code execution system and Jupyter kernel support as async. This makes possible new progress tracking and
live_outputfeatures.The built-in code execution system now provides more robust error handling and error synchronization.
Jupyter kernels now require
jupyter_client>= 6.1.0 for async functionality. Version 6.1.12 or 7.1+ is recommended. The new async Jupyter support should resolve errors withjupyter_client> 6.1.12 (#46). -
When setting
jupyter_kernelfor a session, lowercased kernel display names and kernel language names are now used as aliases in finding the correct kernel. Aliases are used only when they have a single possible interpretation given the kernels installed. For example,pythoncan be used to select thepython3kernel if nopython2kernel is installed. -
Pandoc command-line options
--katex,--mathjax, and--webtexnow work correctly with an optional URL. For example, for--katexPandoc allows--katex[=URL]. -
Caching is now more robust to crashes or program interruption. The output for each session is now cached immediately after execution, rather than waiting until all sessions have finished.
-
Synchronization of code with source line numbers uses a new algorithm that eliminates sync failure in the form of
StopIterationerrors (#36, #38, #44). Synchronization will now be faster and will not raise errors, but may also be less accurate occasionally. -
In stderr output, the user home directory is now sanitized to
~. This is also done in error messages from Jupyter kernels. -
Updated installation requirements:
besponversion 0.6.
-
The built-in code execution system now uses PATH to locate executables under Windows. Previously PATH was ignored under Windows due to the implementation details of Python's
subprocess.Popen()(#41). -
Added support for Pandoc command-line options
-Cand--citeproc(#42). -
rich_outputformats with atext/*mime type can now be displayedraw,verbatim, orverbatim_or_empty. For example,show=rich_output:latex:rawandshow=rich_output:latex:verbatim. -
When a code chunk produces multiple outputs, it is now impossible for these to accidentally merge into a single output that does not represent the intended Markdown. Raw output no longer merges with adjacent output. Adjacent inline code outputs no longer merge into a single, potentially invalid, code output.
-
Most example documents now come with both HTML and Markdown output. This is convenient for seeing how a Markdown-to-Markdown conversion process works. It also significantly simplifies Codebraid testing for new releases, which uses the example documents. The HTML output changes whenever Pandoc updates its HTML templates. Markdown output should be much more stable.
-
codebraidnow reads from stdin (#33). -
Added preliminary support for the Python REPL (
python_repl) via Python'scodemodule. Addedcb.replcommand. -
Synchronization of code with source line numbers is now simpler and more robust to prevent
StopIterationerrors (#36). -
Check for compatible Pandoc version now works correctly with Pandoc 2.10+.
-
Added
live_outputoption for the first code chunk in a session. This shows code output (stdout and stderr) live in the terminal during code execution (#21). -
"Includes" are now skipped during internal, intermediate file transformations, which prevents duplicated "includes" and associated errors (#20). This applies to
header-includes,include-before,include-after,--include-in-header,--include-before-body, and--include-after-body. Roundtrip conversion from Pandoc Markdown to Pandoc Markdown now skips all "includes" and also ignorestoc/table-of-contentsand--toc/--table-of-contents. This allows Codebraid to be used as a preprocessor and saves YAML metadata settings for a subsequent conversion from Pandoc Markdown to another format. -
Added option
jupyter_timeoutfor the first code chunk in a session (#30). -
Fixed Pandoc 2.8+ compatibility by using
-raw_attributein intermediate Markdown. Code output in raw format (interpreted as Markdown) is no longer lost when converting to document formats other than Markdown (#26). -
Added support for SageMath (#5).
-
All document transformations now use
--preserve-tabs, so code indentation is maintained without change and tabs no longer cause errors in syncing code to input line numbers (#18). -
Added support for remaining unsupported Pandoc command-line options, including
--defaults(#14). -
Julia now uses
--project=@.(#10). -
Documentation now includes details of code execution and how this can result in different output compared to interactive sessions (#11).
-
AST walking code no longer assumes that all dict nodes represent types and have a "t" (type) key. Dict nodes without a "t" key are now skipped. This fixes a bug with citations of the form
[@cite](#12).
-
Added support for Jupyter kernels with the
jupyter_kerneloption, which can be used with the first code chunk in a session to specify a kernel. Multiple Jupyter kernels can be used within a single document, and multiple sessions are possible per kernel. Added associatedrich_outputdisplay options. Rich output such as plots is displayed automatically. -
A single cache location can now be shared by multiple documents. When multiple documents are built in a single directory with the default cache settings, they no longer remove each other's cached output.
-
Inline
cb.nbis no longer the same ascb.expr. Inlinecb.nbnow shows output verbatim when used with Codebraid's built-in code execution system, and shows rich output or a verbatim text representation when used with Jupyter kernels. This makes inline and blockcb.nbbehavior more parallel. -
Added
executableoption, which can be used with the first code chunk in a session. This overrides the default executable called by the built-in code execution system. -
Added
include_fileand associated options. This allows code from an external file to be included for execution and/or display. -
Added JavaScript support.
-
Pandoc options like
--syntax-definitioncan now be used multiple times. -
Fixed a bug that prevented
--webtex,--mathjax, and--katexfrom working with Pandoc. They now work when a URL is not specified, but do not yet work when a URL is given. -
When a
pastecode chunk is copied, now everything is copied, not just what is actually displayed by thepastechunk. Improved and simplified copying logic. -
Added
copied_markupoption forshowandhide. This is used withcopyto show the Markdown source of copied code chunks. -
Added keyword argument
hide_markup_keysfor code chunks. This allows specified keys in code chunk attributes to be hidden in the Markdown source displayed withmarkupandcopied_markup. -
Code chunk options
line_anchorsandline_numbersare now properly converted to boolean values. -
Improved option processing.
-
Added Bash support.
-
Added
cb.codecommand that simply displays code and executes nothing. -
Added
cb.pastecommand that allows code and/or output to be copied from other code chunks. -
Added
markupoption forshowandhide. This displays the Markdown source for inline code or a code block. -
Added support for naming code chunks with the
namekeyword. Added support for copying named code chunks into other code chunks with thecopykeyword. -
Runtime source errors (code is improperly divided into code chunks, such as
complete=truewhen it is not) are now handled like any other source errors, rather than as a special instance of stderr. As part of this, the errors now have their own entry in the cache. -
FileNotFoundErrorfor subprocesses now returnsFailedProcesswith correct attribute values. -
Fixed compatibility with languages that do not define an inline expression formatter.
-
Fixed stderr syncing bug for languages that have multiple line number patterns.
-
Fixed compatibility with Pandoc commands in which output format is inferred from output file name. Better output when
codebraidis run with no arguments (#3). -
Code that interferes with Codebraid's templates is now detected and results in error messages.
-
Session names are now restricted to identifier-style strings.
-
In language definitions, field
tempsuffixis renamed totemp_suffix. -
Raw output from code blocks no longer merges with a following paragraph or other block.
-
Improved newline handling. All text is processed in universal newlines mode. Only
\nis treated as a newline for line splitting. This avoids edge cases fromstr.splitlines(). -
outside_mainis now properly checked for compatibility with other options. -
More efficient AST processing.
-
Added Julia, Rust, and R support.
-
Added boolean keyword argument
completefor code chunks. This allows code chunks that contain incomplete units of code, such as part of a function definition or part of a loop. Any stdout from a chunk withcomplete=falsewill appear with the next chunk withcomplete=true(the default value). -
Session hashes are now more robust by including session names and chunk
completestatus. This prevents the collision of sessions with identical code but different processing for code output. -
Added boolean keyword argument
examplefor code chunks. This displays the Markdown source along with the output, putting both inside a single div with classexampleand putting them individually in divs with classesexampleMarkupandexampleOutput, respectively. -
Added boolean keyword argument
outside_mainfor code chunks. Code chunks withoutside_main=trueat the beginning of a session will overwrite the beginning of the Codebraid source template, while code chunks withoutside_main=trueat the end of a session will overwrite the end of the source template. This is primarily for compiled languages like Rust, so that the implicitmain()function defined in the default source template can be overwritten. -
In language definitions,
source_startandsource_endare now combined into a singlesource_template. Delimiter fields are renamed tostdout_delimandstderr_delim(added underscore to parallel future, optional delimiters). -
There is no longer any attempt to sync
RawInlineHTML precisely with the document source, since this can fail in some cases with HTML comments.RawBlockHTML was already not synced precisely due to similar issues. -
More robust stdout and stderr parsing.
- Initial release.