@EricF says that you need a blank line before the [ details ] tag to make the spoiler work properly. Hope that helps.