facundobatista / kilink

A next generation pastebin
GNU General Public License v3.0
25 stars 29 forks source link

Pasted-text type detection must be improved #75

Open facundobatista opened 10 years ago

facundobatista commented 10 years ago

We have plans to do this server side using some AI.

humitos commented 9 years ago

Maybe we can do this in client side by using https://highlightjs.org/ if the user didn't specify the paste type.

facundobatista commented 9 years ago

El 17/11/14 a las 23:24, Manuel Kaufmann escibió:

Maybe we can do this in client side by using https://highlightjs.org/ if the user didn't specify the paste type.

Question: does this support asking the framework about code language? Because we would use that as input to the editor (we don't wan't just colorization)

Also, keep in mind these reasons to do it server side:

Regards,

. Facundo . Blog: http://www.taniquetil.com.ar/plog/ PyAr: http://www.python.org/ar/ Twitter: @facundobatista

humitos commented 9 years ago

Yes, I agree with you.

Anyway, there is a function in that library that "autodetects" the programming language. I tried to read the Javascript source code but I don't have the answer about "How it works?"

This is the specific function:

https://github.com/isagalaev/highlight.js/blob/master/src/highlight.js#L476

damianavila commented 9 years ago

Hey, this is the thing we are actually using right now :stuck_out_tongue_winking_eye:

https://github.com/facundobatista/kilink/blob/master/kilink/static/editor.js#L99

which remind me I have a lot of time without pushing to linkode :disappointed:

btw,

tried to read the Javascript source code but I don't have the answer about "How it works?"

And this is how it works: http://highlightjs.readthedocs.org/en/latest/language-guide.html#relevance