If you want to fix something up at the end of the rendering process, it can be handy to have a script run that can access the rendered text, make changes, and put them back.
The #finalFilter directive works much like #glossary. The names of the scripts are not important. But every script that's in scope when a page is rendered is run just before the text is saved into the html folder.
Here's a screen shot of the #finalFilter sub-outline for my River Lab outline.
The first script replaces a url in the rendered page. The second script echoes the rendered text to the console.
You can access all the rendering parameters through pagetable. The text of the fully rendered page is in pagetable.htmltext.
The name finalFilter comes from the Frontier website framework, which also had firstFilter and pageFilter scripts. We may at some point have those in this framework as well.