message: fix(cli): cli output crashes if script closing tag is in the spec
  fixes
diff: @@ -236,7 +236,7 @@ async function getPageHTML(
  redocHTML: `
  <div id="redoc">${(ssr && html) || ''}</div>
  <script>
  - ${(ssr && `const __redoc_state = ${escapeUnicode(JSON.stringify(state))};`) || ''}
  + ${(ssr && `const __redoc_state = ${sanitizeJSONString(JSON.stringify(state))};`) || ''}
  var container = document.getElementById('redoc');
  Redoc.${
  @@ -306,6 +306,15 @@ function isURL(str: string): boolean {
  return /^(https?:)\/\//m.test(str);
  }
  +function sanitizeJSONString(str: string) {
  + return escapeClosingScriptTag(escapeUnicode(str));
  +}
  +
  +// see http://www.thespanner.co.uk/2011/07/25/the-json-specification-is-now-wrong/
  +function escapeClosingScriptTag(str) {
  + return str.replace(/<\/script>/g, '<\\/script>');
  +}
  +
  // see http://www.thespanner.co.uk/2011/07/25/the-json-specification-is-now-wrong/
  function escapeUnicode(str) {
  return str.replace(/\u2028|\u2029/g, m => '\\u202' + (m === '\u2028' ? '8' : '9'));
  