38

Among the /// tags, it's common to use jsFiddle to give a self-contained example.

Unfortunately, it leads to really, really crappy questions, in that you end up with a question that consists mostly of an outside link. This usually leaves the question as borderline NARQ.

Balsamiq mockups can be embedded in a question on UX and YouTube videos can be embedded on certain Stack Exchange sites. This is enabled through an external API provided by these services.

jsFiddle allows embedding of a fiddle in a page given you have the URL of the fiddle.

That said, if a raw link to a fiddle is encountered on a line of it's own, embed it appropriately as well as embed the original link in the question (possibly through an HTML comment or through a <noscript> tag)

This will give more context to questions and answers that rely heavily on jsFiddle (and let's face it, given the tag soup above, it's the norm).

To be clear, I'm not looking for Stack Exchange to host their own fiddle-like service, the feature request is to embed the content from the already existing service.

10
  • 2
    +1 for the "tag soup" pun alone. Jul 30, 2012 at 16:29
  • 4
    can we embed and keep a copy in a <!-- --> comment or hidden but attached in some way so it goes into the datadumps too? (And works if jsfiddle dies)
    – Flexo
    Jul 30, 2012 at 16:33
  • 1
    @Flexo or wrap it in a <noscript>
    – Ben Brocka
    Jul 30, 2012 at 16:35
  • 1
    Don't we want to discourage fiddle only posts? Having the system "embed that for you" is kind of enabling people to post link only answers/questions...
    – Lix
    Jul 30, 2012 at 16:36
  • @lix jsFiddle links (or ideone) is great so long as it's not the only thing and not just a link. That would seem to fix the problem nicely.
    – Flexo
    Jul 30, 2012 at 16:37
  • 1
    @Lix Yes, I'd like to, but it's a battle we seem to be losing here. I don't think this will solve all the problems, but it would help greatly in making the content on the page much more valuable. We rely on smaller (Balsamiq) and larger (YouTube) sites to provide context for questions on other sites, we might as well start doing it on Stack Overflow (where it makes sense and there's an obvious gain).
    – casperOne
    Jul 30, 2012 at 16:39
  • 1
    If we add jsFiddle then I want SQLFiddle too!
    – juergen d
    Jul 30, 2012 at 17:44
  • 1
    Even for non link-only questions embedding the fiddles would be great. +1 and enjoy your badge :) Jul 30, 2012 at 17:54
  • A JS Bin hosted on SE would solve the issue better than a third party site.
    – fuxia
    Aug 1, 2012 at 21:18
  • By embed do you mean like an iframe, or pull the code via the API and have it dumped into the actual post? Like auto-fill.
    – random
    Jun 15, 2014 at 13:07

3 Answers 3

17

I disagree with embedding this from a technical standpoint, there's one hugely important aspect to anything we embed: it has to be stable, and jsFiddle simply isn't (yet). They are having outages as they go through some growing pains...and an answer being offline because of its useful content is on a downed third-party service isn't a position we want to be in.

When we "bless" a way for answer content to appear, we're saying that it's ok that the embed is the answer (or most of it, at least)...and not a supplement to the answer that stands on its own. That's fine, if we can depend on the content being there, and at this point, we can't.

This doesn't address the "it doesn't cover any language other than JavaScript" (of which we have many) side of things either, that's a whole other discussion if this were a good option for embed itself.

Keep in mind I don't say this as just a developer, but as someone who uses jsFiddle in their answers quite a bit.

13
  • 3
    So given the preponderance of jsFiddle links in Stack Overflow questions and answers where that's the only content, isn't it in Stack Exchange's best interests to help them make it stable? Right now, if jsFiddle went down permanently, that's it, a ton of questions on Stack Overflow go out the window. I don't disagree that it should be stable, but if so many posts rely on it already as the sole source of content, then it could be something worth looking into (and then this would be a nice side effect of helping make them stable). I mean, we're all about making the Internet better, no?
    – casperOne
    Jul 30, 2012 at 16:45
  • If we embed and clone there's a fallback. Something (e.g. an easy way to link and quote in a code block) should be done given the volume of users who think just a jsFiddle is sufficient. Automatically fixing that in some way seems the nicest solution.
    – Flexo
    Jul 30, 2012 at 16:46
  • 5
    @casperOne - you're pitching a scenario in which link-only content is okay...it's not, and never has been. Basing the argument on something else we don't support isn't the right place to start. Also, how do you propose we help make them stable? Jul 30, 2012 at 16:47
  • @Flexo - no, not really...because you're free to update the fiddle at any time without our knowledge, this isn't possible with youtube or balsamiq due to how they work. For example, balsalmiq is not a simple drop in, we worked with their developer so that the source is stored on our side with special editor changes they made to accommodate it being incorporated into our sites. Jul 30, 2012 at 16:48
  • @NickCraver Can you run an in house instance of jsFiddle then? The functionality is really useful, which is why people like it so much. Seems like the sort of thing the people behind jsFiddle would like.
    – Flexo
    Jul 30, 2012 at 16:49
  • 1
    @Flexo - what about all the other languages? That's not a small ask, not even close...and it only tackles one language. jsFiddle already exists as an excellent supplement, supporting an embed to replace link only answers would just serve to upgrade them from link-only to code-only, which is rarely ever okay either. Hosting it in-house doesn't solve the content issues, just the stability one after a very, very significant dev investment to do so. Jul 30, 2012 at 16:54
  • @NickCraver I don't think link-only content is ok, but frankly, we're losing this battle. Better to make the content on the page better where we can to try and gain some ground back. As for how to help them, that's where you guys come in. I wouldn't be the one asking them what the root of their stability issues are. I'm sure Balsamiq had to be vetted beforehand, the process here would be similar.
    – casperOne
    Jul 30, 2012 at 17:03
  • 3
    @casper: I think what Nick's saying is, you're asking for a non-trivial amount of dev work to make some of the worst answers slightly less-bad. It's also possible it would make some good answers slightly better - but that's even more of a crap-shoot.
    – Shog9
    Jul 30, 2012 at 17:54
  • 1
    @Shog9 It's not just answers, it's questions as well. Also, not discounting the amount of effort. However, the effort here is less than the social engineering effort you'd have to perform in order to definitively solve the issue in the first place. I'm all for addressing the root problem (perhaps just ban jsFiddle altogether).
    – casperOne
    Jul 30, 2012 at 18:04
  • Solving the problem in this case amounts to finding a way to turn lead into gold. We can find some useful things to do with all this lead, and we can encourage the production of more gold, but there's no philosopher's stone. jsFiddle is a useful tool that is frequently abused.
    – Shog9
    Jul 30, 2012 at 18:57
  • From my perspective I'd largely given up flagging or commenting on jsFiddle only posts - it seems accepted, even expected in the relevant tags (example, another, a question, again, here). People reply to "can you show it here too please?" comments with answers that amount to "why would I duplicate this content?" because jsFiddle is useful.
    – Flexo
    Jul 30, 2012 at 19:01
  • 1
    @Flexo We seem to be at a paradox then. We all know that jsFiddle-only answers are in poor form. However, we accept that as an exception of link-only answers (or rather, it's begrudgingly accepted). If we aren't going to make the social engineering effort, then we should make some sort of technical effort to improve quality in these situations. Whether that results in an embed or a ban makes no difference, the point is, something should be done.
    – casperOne
    Jul 31, 2012 at 12:03
  • @Shog9 Hey, x-ray shielding. No disagreement that it is abused. Also, see my comment to Flexo above.
    – casperOne
    Jul 31, 2012 at 12:03
6

I think this requires another look given that the co creator of JSFiddle Oskar Krawczk offered to help make this happen.

If JS Fiddle is willing to work specifically with SE to embed somehow, I bet they'd be willing to let SO host the code itself in the fiddles, that's easy enough. It's text, duplicate it and stick it in a table somewhere or host the code off of SE's servers or whatever. Blocking JS fiddle without code has caused some friction and really indicates a greater problem; we're not making use of an awesome tool here when a co-creator has stepped up and offered to help make it happen, and copying code is...so very, very easy.

0

Would it be possible to embed an iframe similar to those generated by PythonFiddle (or repl.it, or Trinket.io) but which runs in the browser? There is the pypyjs library, Skulpt, and (for Python 3+) there is Brython. I would LOVE to see a browser REPL that executes with a Brython "backend".

SO or SE and Github all support different Markdown flavors, and there are many markdown-html compiler scripts that are helpful for blogging, tutorials, etc (there is a SublimeText package that does this). A good starting point would be to make a script that compiled markdown to HTML-embedded, javascript-based REPL.

Just imagine this syntax:

Brython for i in range(10): print(i)

and you wind up with a REPL containing that code!

To me, this Syntax is more important than whether SE will automatically render iframes for the following reason: a core principle of Markdown is that it is readable without any rendering. Embedding an external iframe link absolutely violates this principle.

Not the answer you're looking for? Browse other questions tagged .