ChrisPenner / slick

Static site generator built on Shake configured in Haskell
BSD 3-Clause "New" or "Revised" License
204 stars 24 forks source link

Cross reference in documents? #16

Closed omalaspinas closed 3 years ago

omalaspinas commented 3 years ago

Hello,

thanks a lot for the awesome work. I like slick a lot (I gave a try to hakyll some months ago and was not really satisfied). I was wondering if you had any idea on how to integrate pandoc-crossref to allow equation/table/figure/... cross reference in slick?

Thanks in advance for the answer.

ChrisPenner commented 3 years ago

Hello; glad it's working for you!

slick doesn't have default support this explicitly, but it's pretty adaptable so I think you should be able to figure something out.

I'm not very familiar with the plugin, but luckily it looks to be built in haskell!

I assume you could make it work using some combination of loadUsing' and defaultCrossRefAction.

Pretty much you'll a markdown reader like readMarkdown, and run the plugin on the output, you'll have to coerce that into the shape of slick's PandocReader's, but it shouldn't be too tough I don't think.

Keep in mind that slick is a very thin layer on top of pandoc, so you can always drop down into just using pandoc directly for the bits you can't get slick to accomplish. Best of luck!

P.S. Don't be afraid to look at the source code for slick's readers and writers, they're a bit nested, but nothing is too terribly complex until you get to the bottom layer; Here's the markdown to html converter's source

omalaspinas commented 3 years ago

Thanks for the answer! If you think it's feasible I'll look into it. It makes a good excuse to learn a bit more Haskell!