PrismJS / prism

Lightweight, robust, elegant syntax highlighting.
https://prismjs.com
MIT License
12.28k stars 1.3k forks source link

Cannot get autolinker to work at all #222

Closed kinghrothgar closed 10 years ago

kinghrothgar commented 10 years ago

I have tried many several methods, and I can't get the autolinker plugin to work. A previous issue had mentioned that it didn't work when downloaded from the site, so I got it separately from the repo and it still didn't work. This page is an example: http://gobin.io/oedr?bash . I put up the un-minified versions downloaded from the site. Am I just missing something entirely?

nauzilus commented 10 years ago

Autolinker will only look for links in places they should reasonably exist, namely comments, urls (as in, the CSS url token), attribute values (markup) and strings (valid strings, according to the language). A URL simply entered in to bash isn't valid I don't believe (you'd get an error if you opened up bash, typed a URL and hit enter right?), so the syntax highlighter isn't looking for links there.

If you change your example to one of the following:

# http://github.com/kinghrothgar/goblin-scripts

or

foo="http://github.com/kinghrothgar/goblin-scripts"

it should work (at least it did for me).

Or change your language to markup, where links are expected to be floating around plainly.

kinghrothgar commented 10 years ago

Thanks for the quick reply. That's was indeed my problem.