chrisprice / t-d3fc

A service powering a collection of tweet-sized d3 creations
https://t.d3fc.io
MIT License
57 stars 7 forks source link

Hashtags are removed from tweet #32

Open owennw opened 8 years ago

owennw commented 8 years ago

Even inadvertent ones:

(rn(0,6)).a({rx:9,ry:2,cx:(d,i)=>2_i+150_s(t/4e2)}).y({fill:d=>'#'+String.fromCharCode(70-d)+'13',stroke:'#C13'}) https://t.d3fc.io

The stroke code is not parsed on the website.

owennw commented 8 years ago

Should note that this works in the playground, so is most likely just a parsing error.

chrisprice commented 8 years ago

The implementation currently strips everything which Twitter defines as an entity and then attempts to parse the result using babel. If this is successful it makes it on to the site.

The entity stripping is done as an easy and reliable way of removing any leading or trailing @mentions, #hashtags or other URLs.

Currently the only way around this would be to split the string after the # e.g. stroke:'#'+'c13'.

I don't think I'm going to change the behaviour because it's an easy rule to understand. However, it is annoying that the playground doesn't also implement this functionality. Not sure of a good way of copying the behaviour though.