diff --git a/src/TocTwigExtension.php b/src/TocTwigExtension.php index ffc1ba5..6d39121 100644 --- a/src/TocTwigExtension.php +++ b/src/TocTwigExtension.php @@ -94,6 +94,10 @@ class TocTwigExtension extends Twig_Extension return $this->generator->getMenu($markup, $top, $depth); }); + $functions[] = new \Twig_SimpleFunction('add_anchors', function($markup, $top = 1, $depth =2) { + return $this->fixer->fix($markup, $top, $depth); + }, ['is_safe' => ['html']]); + return $functions; }