Code Appendix with Results

Introduction

This document demonstrates how the regurgitate extension handles code execution results.

With show-output-results: true (the default), both code and its output are copied to the appendix.

Python Example

Let’s do some calculations:

print("Hello from Python!")
Hello from Python!
result = 2 + 2
print(f"2 + 2 = {result}")
2 + 2 = 4

R Example

Some R calculations:

# Create a vector
numbers <- c(1, 2, 3, 4, 5)
print(paste("Sum:", sum(numbers)))
[1] "Sum: 15"
print(paste("Mean:", mean(numbers)))
[1] "Mean: 3"
plot(numbers)

Conclusion

Notice that in the Code Appendix at the end:

  • Code blocks are shown
  • Output/results from code execution are also shown (because show-output-results: true)

To see only code without results in the appendix, set show-output-results: false.


Code Appendix

print("Hello from Python!")
Hello from Python!
result = 2 + 2
print(f"2 + 2 = {result}")
2 + 2 = 4
# Create a vector
numbers <- c(1, 2, 3, 4, 5)
print(paste("Sum:", sum(numbers)))
[1] "Sum: 15"
print(paste("Mean:", mean(numbers)))
[1] "Mean: 3"
plot(numbers)