Fix issue when Yaml is contained in a diagnostic