hook_anchor: Anchor Chunk Hook Extension for package:knitr

View source: R/hook_anchor.r

hook_anchorR Documentation

Anchor Chunk Hook Extension for package:knitr

Description

knitr hook functions are called when the corresponding chunk options are not NULL to do additional jobs beside the R code in chunks. kfigr provides the hook "anchor" which adds an HTML anchor tag immediately above a code chunk.

Usage

hook_anchor(before, options, envir)

Arguments

before, options, envir

see references

Details

the function hook_anchor is set as a hook in knitr when kfigr is attached (and removed when kfigr is detached). It writes an HMTL anchor tag directly above a code chunk in the form <a name="chunk-name"></a> where chunk-name is the chunk label contained in options$label.

References

http://yihui.org/knitr/hooks#chunk-hooks

See Also

figr, anchors

Examples

## Not run: 
require(knitr)
knit_hooks$set(anchor = hook_anchor)
# then in code chunks, use e.g. the option anchor = "figure"

## End(Not run)


mkoohafkan/kfigr documentation built on Jan. 17, 2024, 1:12 a.m.