0
votes

I have several code blocks on a Jekyll page that is similar to this:

<script src="https://cdn.jsdelivr.net/npm/prebid-universal-creative@latest/dist/creative.js"></script>
<script>
  var ucTagData = {};
  ucTagData.adServerDomain = "";
  ucTagData.pubUrl = "%%PATTERN:url%%";
  ucTagData.targetingMap = %%PATTERN:TARGETINGMAP%%;

  try {
    ucTag.renderAd(document, ucTagData);
  } catch (e) {
    console.log(e);
  }
</script>

I am using `` ```javascript` to designate the code block and provide syntax highlighting. In each of the these code blocks, the closing script tag

</script>

is getting a red warning box

enter image description here

If I delete the the slash in the closing script tag the warning blocks go away. I am using kramdown for the Markdown and Rouge for the highlighting, but this was also happening with the defauly Pygments.

Is there a way I can escape that forward slash? Should I have to? Any help would be appreciated.

1

1 Answers

2
votes

<script> is HTML, not JavaScript.

Either remove the HTML tags from your JavaScript snippet or change your fenced code block to ```html.