简体   繁体   中英

Jekyll, Markdown, adding warning box in code block

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

在此处输入图片说明

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.

<script> is HTML, not JavaScript.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM