DFE-Digital / register-early-career-teachers

This application will replace the Manage training for early career teachers service in 2025.
5 stars 0 forks source link

Markdown templates aren't rendering quite right #695

Open peteryates opened 2 days ago

peteryates commented 2 days ago

The markdown templates are repeating the front matter in the body.

I'm pretty certain this is because in config/initializers/markdown_renderer.rb we call erb_handler#call twice:

front_matter = erb_handler.call(template, page_sections[:front_matter])
page_content = erb_handler.call(template, page_sections[:markdown])

Each time returns a string that's later eval'd, like this:

 " @output_buffer.safe_append='\nFIXME: Teacher has already completed an induction\n'.freeze;\n@output_buffer"

So the output buffer is appended to twice, once for the front matter and once for the body.

It think we should forego erb in the front matter for now if there's no easy clean fix.

Refs #694