we render the code-folding scaffolding too early (in layout), which makes it hard for custom renderers to do the right thing. Instead, we should be rendering that format-specific scaffolding during the rendering part of the pipeline.