Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noscript output seems to break sometimes when using Commonmark #82

Closed
0xdevalias opened this issue Jul 22, 2020 · 1 comment
Closed

Comments

@0xdevalias
Copy link

This plugin seems to break it's output when attempting to embed the following gist when noscript is enabled, and jekyll-commonmark is used as the markdown renderer

_config.yml

markdown: CommonMark

commonmark:
  options: ["UNSAFE", "FOOTNOTES", "STRIKETHROUGH_DOUBLE_TILDE", "VALIDATE_UTF8", "GITHUB_PRE_LANG", "HARDBREAKS"]
  extensions: ["autolink", "strikethrough", "table", "tasklist"]

Rendered snippet
<p><noscript><pre># Dogedraw, now with more Nyaan!</p>
<p>Paste these functions into the js console on <a href="https://dogedraw.firebaseapp.com">https://dogedraw.firebaseapp.com</a> and run them to nyaan nyaan nyaan..</p>
<p>Developed at <a href="http://hs.hact.io">http://hs.hact.io</a> 2015!!</p>
<pre><code>function clearScreen(w, h, color) {
  var pixelDataRef = new Firebase(&amp;#39;https://dogedraw.firebaseio.com/pixels&amp;#39;);
  for (var i = 0; i &amp;lt; h; i++) {
    for (var j = 0; j &amp;lt; w; j++) {
      pixelDataRef.child(j + &amp;quot;:&amp;quot; + i).set(color);
    }
  }
}
    
function nyaan(startX, startY) {
  function rpt(value, times) {
    var arr = [];
    for (rpti = 0; rpti &amp;lt; times; rpti++) {
      arr[rpti] = value;
    }
    return arr;
  }

  function cc(arr) {
    var joined = [];
    for (cci = 0; cci &amp;lt; arr.length; cci++) {
      joined = joined.concat(arr[cci]);
    }
    return joined;
  }

  var nyaanHax = new Firebase(&amp;#39;https://dogedraw.firebaseio.com/pixels&amp;#39;);

  var w = &amp;quot;fff&amp;quot; // white
  var bl = &amp;quot;00f&amp;quot; // blue
  var k = &amp;quot;000&amp;quot; // black
  var r = &amp;quot;f00&amp;quot; // red
  var gy = &amp;quot;333&amp;quot; // grey
  var gr = &amp;quot;0f0&amp;quot; // green
  var y1 = &amp;quot;FFFFE0&amp;quot; // pale yellow
  var y2 = &amp;quot;FFFF00&amp;quot; // yellow
  var o = &amp;quot;FF4500&amp;quot; // orange
  var p1 = &amp;quot;FFC0CB&amp;quot; // pink
  var p2 = &amp;quot;9370DB&amp;quot; //purple
  var p3 = &amp;quot;800080&amp;quot; // dark purple

  var nyaan = []
  nyaan[0] = rpt(w, 38)
  nyaan[1] = cc([rpt(w, 3), rpt(r, 6), rpt(w, 7), rpt(k, 14), rpt(w, 8)])
  nyaan[2] = cc([[w], rpt(r, 14), [k], rpt(y1, 14), [k], rpt(w, 7)])
  nyaan[3] = cc([[w], rpt(r, 3), rpt(o, 5), rpt(r, 5), [k, y1, y1], rpt(p1, 4), [p2, p1, p1, p2], rpt(p1, 3), rpt(y1, 3), [k], rpt(w, 6)])
  nyaan[4] = cc([[w], rpt(o, 13), [k, y1], rpt(p1, 2), [p2], rpt(p1, 4), [k, k], rpt(p1, 5), [y1, k, w, k, k], rpt(w, 3)])
  nyaan[5] = cc([[w], rpt(o, 3), rpt(y2, 4), rpt(k, 4), rpt(o, 2), [k, y1], rpt(p1, 6), [k, gy, gy, k], [p1, p1, p2, p1, y1, k, k, gy, gy, k], rpt(w, 2)])
  nyaan[6] = cc([[w], rpt(y2, 6), [k, gy, gy, gy], rpt(k, 4), [y1], rpt(p1, 6), [k, gy, gy, gy, k], rpt(p1, 3), [y1, k, gy, gy, gy, k], rpt(w, 2)])
  nyaan[7] = cc([[w], rpt(y2, 3), rpt(gr, 3), [k, k], rpt(gy, 5), [k, y1], rpt(p1, 3), [p2], rpt(p1, 2), [k], rpt(gy, 4), rpt(k, 4), rpt(gy, 4), [k], rpt(w, 2)])
  nyaan[8] = cc([[w], rpt(gr, 8), rpt(k, 4), [gy, k, y1], rpt(p1, 6), [k], rpt(gy, 12), [k], rpt(w, 2)])
  nyaan[9] = cc([[w], rpt(gr, 3), rpt(bl, 8), rpt(k, 3), [y1], rpt(p1, 4), [p2, k], rpt(gy, 3), [w, k], rpt(gy, 5), [w, k, gy, gy, k, w]])
  nyaan[10] = cc([[w], rpt(bl, 13), [k, y1, p1, p2], rpt(p1, 3), [k], rpt(gy, 3), [k, k], rpt(gy, 3), [k, gy, k, k, gy, gy, k, w]])
  nyaan[11] = cc([[w], rpt(bl, 3), rpt(p3, 5), rpt(bl, 5), [k, y1], rpt(p1, 3), [p2, p1, k, gy, p1 ,p1], rpt(gy, 9), [p1, p1, k, w]])
  nyaan[12] = cc([[w], rpt(p3, 12), [k, k, y1, y1, p1, p2, p1, p1, k, gy, p1, p1, gy, k, gy, gy, k, gy, gy, k, gy, p1, p1, k, w]])
  nyaan[13] = cc([[w], rpt(p3, 3), rpt(w, 5), rpt(p3, 2), rpt(k, 4), rpt(y1, 3), rpt(p1, 4), [k], rpt(gy, 3), rpt(k, 7), rpt(gy, 2), [k, w, w]])
  nyaan[14] = cc([rpt(w, 10), [k, gy, gy, gy, k, k], rpt(y1, 7), [k], rpt(gy, 10), [k], rpt(w, 3)])
  nyaan[15] = cc([rpt(w, 10), [k, gy, gy, k, w], rpt(k, 19), rpt(w, 4)])
  nyaan[16] = cc([rpt(w, 10), rpt(k, 3), rpt(w, 3), [k, gy, gy, k, w, w, w, k, gy, gy, k, w, k, gy, gy, k], rpt(w, 6)])
  nyaan[17] = cc([rpt(w, 17), rpt(k, 3), rpt(w, 4), rpt(k, 3), rpt(w, 2), rpt(k, 3), rpt(w, 6)])
  nyaan[18] = rpt(w, 38)

  for (var i = 0; i &amp;lt; nyaan.length; i++) {
    for (var j = 0; j &amp;lt; nyaan[i].length; j++) {
      nyaanHax.child(parseInt(startX+j) + &amp;quot;:&amp;quot; + parseInt(startY+i)).set(nyaan[i][j]);
    }
  }

  return &amp;quot;I drew a cat!&amp;quot;
}
```&lt;/pre&gt;&lt;/noscript&gt;&lt;script src=&quot;https://gist.github.com/0xdevalias/e8bb28726a37854606ad.js&quot;&gt; &lt;/script&gt;
</code></pre>

In particular, the end part of the rendered noscript seems to be getting itself confused, and then ends up breaking the output:

```&lt;/pre&gt;&lt;/noscript&gt;&lt;script src=&quot;https://gist.github.com/0xdevalias/e8bb28726a37854606ad.js&quot;&gt; &lt;/script&gt;
</code></pre>

This doesn't appear to happen on other posts where I have gists embedded.

My theory is that maybe because the gist ends in a triple backtick codeblock (possibly with no newline?), that that may be breaking something within this plugin, that then flows on to breaking how commonmark parses/renders things?

@jekyllbot
Copy link
Contributor

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.

@jekyll jekyll locked and limited conversation to collaborators Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants