retrogradeorbit / bootleg

Simple template processing command line tool to help build static websites
Eclipse Public License 2.0
254 stars 12 forks source link

Support markdown-clj options (footnotes and reference links) #76

Closed dominicfreeston closed 2 years ago

dominicfreeston commented 2 years ago

Great project, I've been playing with babashka and bootleg to generate my site - maybe I'll become one of the examples here later :smile:

One of the things I'm missing at the moment is that I use footnotes, which is supported by markdown-clj but requires passing it as an option. I took the approach of just extending the use of the existing options and passing them all to markdown-clj too. It makes the API a little weird because the latter takes them in the form :footnotes? true whilst bootleg just takes a list of keywords, but it doesn't seem like too big of a deal.

This now uses md-to-html-string for both types of sources because using a normal input stream causes markdown-clj to output nothing when options are used because the underlying implementation does multiple passes and consumes the stream on the first one. Not sure if there's a meaningful performance hit by reading the whole file in one go - the alternative might be to go fix markdown-clj upstream then update the dependency here, but that's a much longer process :sweat_smile:

I've not been able to test a native build locally because I'm working on an old computer at the moment and I don't have enough RAM for Graalvm to generate the native image :see_no_evil: - the tests pass in pure Java world though so hopefully everything's OK.

Let me know what you think, happy to change the approach if you think it can be improved. Thanks!

borkdude commented 2 years ago

@dominicfreeston FYI: https://blog.michielborkent.nl/markdown-clj-babashka-compatible.html

retrogradeorbit commented 2 years ago

good PR @dominicfreeston thankyou