6

When asking a question, you can't just use a snippet and link to JSFiddle or Codepen, as for some reason it doesn't detect the snippet as valid code.

There was a question that had a link to codepen, also had a bunch of code properly indented, and I edited it as the text of the question wasn't that good. I also snippeted the code, and then I couldn't submit the edit as now it wasn't detecting any code indented or in backticks.

Is this by design, or a bug?

4

1 Answer 1

12

OK, that is by design.

When sloppy users leave a bare link to CodePen the quality filter kicks in.

So anything that looks like this:

https://codepen.io/s4ek1389/pen/MbarmG?editors=1100

will not get past the check.

It is simply resolved by adding some markdown to that link:

[Codepen](https://codepen.io/s4ek1389/pen/MbarmG?editors=1100)

so it no longer is a bare link.

Problem solved.

I've edited Can't align image with div with the above trick.


Please note that both JSFiddle and Codepen have license models that might disallow anyone else but the OP from bringing code one-on-one over from those sites.

4
  • Nicely done! :)
    – CalvT
    Commented Feb 9, 2017 at 17:19
  • 1
    I don't know much about this "webby" stuff, but why do you need a CodePen link if you have a Stack Snippet? They seem redundant, with the Stack Snippet being preferable since it keeps all the content here, as part of the question.
    – Cody Gray Mod
    Commented Feb 10, 2017 at 10:07
  • 2
    @CodyGray well, CodePen (and JsFiddle) are a bit richer in functionality so there might be cases where it is simply easier to go the CodePen or JsFiddle instead of only relying on the StackSnippet. So, yes: do bring code from CodePen and JsFiddle in the question, preferable as a Stack Snippet but don't get rid of the link as that would make things harder for visitors, not easier.
    – rene
    Commented Feb 10, 2017 at 10:39
  • Be careful when copying code from external sites to Stack Overflow; you may be changing the license of the code, something only the copyright owner should be doing... Commented Apr 16, 2020 at 14:59

You must log in to answer this question.

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