DocExec is a tool designed to parse documentation files, extract code blocks, execute them, and update the documentation with the execution results. It serves as an executable documentation solution, similar to tools like Jupyter notebooks but tailored for general documentation formats.
Key Features:
Parses documentation files (e.g., Markdown, Wiki) to identify code blocks.
Executes extracted code blocks using specified shell commands or main classes.
Updates console sections within documentation with the execution results.
Replaces file content in documentation based on defined file blocks.
Supports multiple languages and environments for executing code.
Can be embedded as a library or used via a command-line interface.
Audience & Benefit:
Ideal for developers, technical writers, and teams seeking to maintain accurate and executable documentation. DocExec streamlines the process of updating examples and test cases in documentation, ensuring content remains current and reliable. By embedding execution results directly into files, it enhances clarity and reduces manual updates, ultimately improving the quality and utility of shared documentation.
README
DocExec
About
doc-exec is a tool that can:
parse documentation files,
extract code blocks,
execute them,
and update the documentation with the execution result.
It's similar to executable documentation tools like Jupyter notebooks but for general
documentation formats.
// The documentation file to execute
final Path path = Paths.get("./src/test/resources/docTest/fileTest.txt");
// Execution
List docTestRuns = DocExecutor
.create("run-name")
// where to find the files to inject
.setBaseFileDirectory(Paths.get("./src/test/resources"))
.setShellCommandExecuteViaMainClass("cat", CommandCat.class)
.build()
.run(path);