2012-03-24, 03:34:43
I have considered that, but I am not a fan of content modification before save, too complex, high risk on failure if something went wrong, corrupt content etc, plus there is no preview in GS, you wouldn't even know something went wrong until after save.
Maybe I can just optionally enable it always on all pages via something you call or declare in your theme before calling gettoc and getcontent functions.
Then you can call a function
sa_toc_useToc() at the earliest possible time.
Then you can call sa_toc_getToc() or getContent() anytime after.
I can also add a nomenu argument so you can trigger the id generation but not include menus in specific pages, say if you want to externally link to the anchors from somewhere else.
I can deal with caching the menu later on to avoid the double scan , but its super fast since I am using dom, so might be negligible.
Maybe I can just optionally enable it always on all pages via something you call or declare in your theme before calling gettoc and getcontent functions.
Then you can call a function
sa_toc_useToc() at the earliest possible time.
Then you can call sa_toc_getToc() or getContent() anytime after.
I can also add a nomenu argument so you can trigger the id generation but not include menus in specific pages, say if you want to externally link to the anchors from somewhere else.
I can deal with caching the menu later on to avoid the double scan , but its super fast since I am using dom, so might be negligible.