Table of Contents in a Right Panel

I am currently using the show/hide panels extension. Is there a way to put the table of contents macro for each page into the right side panel?

You can create your own panel with this code. It will show TOC of current page.

{{velocity}}
#panelheader('Table of Contents')
{{context document="$services.model.serialize($doc.documentReference)" transformationContext="document"}}
{{toc/}}
{{/context}}
#panelfooter()
{{/velocity}}