ANN: XKCD.jl: Retrieve images and hover text from XKCD webcomic

I had a bit of fun this morning filling an obvious void in the Julia ecosystem:

using XKCD

# Dict{Symbol,String} with 2 entries:
#   :imgsrc => ""
#   :hover  => "Correlation doesn't imply causation, but it does waggle its eyebrows suggestively and gesture furtively while mouthing 'look over there'."

It’s not registered. Why is it not registered?!? :smile:



Note the behavior has changed a little bit:

julia> XKCD.comic()
JSON3.Object{Base.CodeUnits{UInt8,JSON3.VectorString{Array{UInt8,1}}},Array{UInt64,1}} with 11 entries:
  :month      => "1"
  :num        => 2251
  :link       => ""
  :year       => "2020"
  :news       => ""
  :safe_title => "Alignment Chart Alignment Chart"
  :transcript => ""
  :alt        => "I would describe my personal alignment as \"lawful heterozygo…
  :img        => "…
  :title      => "Alignment Chart Alignment Chart"
  :day        => "6"

Just chiming in to say XKCD.jl has new capabilities on master. Release coming soon!


Is there a way to view the comics within VS Code?

Is there a way to view the comics within VS Code?

What’s shown above is just a MIME"text/html" show method for XKCD.Comic. Anything that can use that mimetype should work. I wonder if there’s a way to hack into the plot pane in the Julia extension.

Good question. It looks like display is one way to open a plot in the plot pane. Unfortunately, it is not clear to me how it works.

Here is something that could be integrated into your package somehow:

using FileIO, ImageShow

url = ""

download(url) |> load