Skip to content

Loading…

gist import appends spaces to blank lines creating jsbin warnings #512

Closed
mikegrassotti opened this Issue · 6 comments

3 participants

@mikegrassotti

So normally the spaces would be no big deal, but now jsbin is gonna warn you about them. that's a bummer cause it prevents you from noticing any real warnings.

Not sure if it impacts every gist, but here's mine:

https://gist.github.com/mikegrassotti/4991413

Once imported to jsbin, the .js file has spaces on every blank line. http://jsbin.com/erebis/1/edit

jsbin-sad

@remy
Dave, The Bin Bot member

Those aren't spaces. I've been investigating, but the character code in those (fake?) spaces is 160, and the character code for a space is 32 - so those are something else...

Is this happening for all gists?

I've got a fix in the wings, but it's dynamically removing the unicode character \u00a0 (which is this particular space) - but it feels a little hackish.

@mikegrassotti

Ah ok, not spaces. Nothing is more fun that debugging a char encoding issue.

Tried with a few more, it does seem to be happening for all gists.

Agreed sounds hackish, very strange that you'd need to do something like that. No rush from my perspective, maybe a more elegant solution will present itself.

@dbieber

I was trying to make a gist of some Python code that could just be pasted into a python REPL and work, but these non-spaces are causing problems. Any good workaround?

@remy
Dave, The Bin Bot member

@dbieber just strip them. It's a pain, but if you can do it via sed script or something then it's not too bad.

@remy remy closed this
@dbieber

@remy that isn't the issue. I'd like to include the gist in a blog post so that a reader can simply paste the code into a python interpreter and have it work right away. As it is, the code works with the spaces it's saved in a file and then run. However it doesn't work if it's pasted in a python interpreter with the spaces (maybe the interpreter requires 0-indentation for a line to be considered complete). Take a look: david-bieber.tumblr.com/post/45294395663/automate-your-life-sending-emails

edit: Unless you were suggesting stripping them with JavaScript, which could work.

@remy
Dave, The Bin Bot member

@dbieber Obviously beyond the scope of this jsbin project, but if it's an indentation issue due to gists doing something strange with spaces and it conflicting with python, I don't really know what to say - and I don't think you can clean up with JS as it's in an external iframe (there's ways, but way beyond this comment). Or post an issue on github?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.