简体   繁体   English

Jekyll,Markdown,在代码块中添加了警告框

[英]Jekyll, Markdown, adding warning box in code block

I have several code blocks on a Jekyll page that is similar to this: 我在Jekyll页面上有几个与此相似的代码块:

<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. 我使用``javascript''来指定代码块并提供语法高亮显示。 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. 我在Markdown和Rouge中使用kramdown进行突出显示,但是默认的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. <script>是HTML,不是JavaScript。

Either remove the HTML tags from your JavaScript snippet or change your fenced code block to ```html . 从您的JavaScript代码段中删除HTML标记,或将受防护的代码块更改为```html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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