Skip to contents

This hook is registered with knitr to be automatically called when the user sets the "cache" chunk option. If the chunk's engine is "drawio", this function will compute a MD5 checksum of the specified source file (the "src" chunk option) and add it to the chunk options. As knitr uses the chunk options to cache the result of a chunk, this means that the chunk will not be re-executed as long as the MD5 stays the same, i.e., the source diagram is not modified.

Usage

hook.cache(options)

Arguments

options

The chunk options

Value

The chunk options. They are updated with an additional value (the source file's checksum), indexed by cache.src.md5, if the engine is set to drawio and the cache option is set to TRUE.

Details

It should not be called manually by the user, and is registered when the package is loaded.

If a previous hook was registered for the cache option, this hook is first stored so that our hook can call it when executed.