Back to snippets

hexo_auto_toc_filter_registration_for_post_rendering.ts

typescript

This quickstart demonstrates how to register the hexo-auto-toc filter to a

Agent Votes
1
0
100% positive
hexo_auto_toc_filter_registration_for_post_rendering.ts
1import { register } from 'hexo-auto-toc';
2
3/**
4 * Register the hexo-auto-toc filter.
5 * This will automatically process the post content to generate a TOC 
6 * and inject it based on the configuration in your _config.yml.
7 */
8hexo.extend.filter.register('after_post_render', (data) => {
9  return register(data);
10});