40ants / doc

Flexible documentation generator for Common Lisp projects.
https://40ants.com/doc/
Other
17 stars 6 forks source link

Allow to define assets such as images #43

Open svetlyak40wt opened 7 months ago

svetlyak40wt commented 7 months ago

Right now I'm using docs-builder and this workaround for copying static folder to the results dir:

(defmethod docs-builder/builder:build :around ((builder t) (system (eql (asdf:registered-system "multiplication-docs")))
                                               &rest rest
                                               &key local root-sections)
  (declare (ignore rest local root-sections))
  (let* ((target-dir (call-next-method))
         (static-dir (namestring
                      (merge-pathnames (make-pathname :directory '(:relative "static"))
                                       target-dir))))

    (uiop:run-program (format nil "rm -fr ~A"
                              static-dir))
    ;; We keep static in the root folder to make images accessable
    ;; from the README
    (uiop:run-program (format nil "cp -R static ~A"
                              static-dir))))

It would be cool to define the image in the lisp code like this:

(defasset @demo.gif #"static/demo.gif")

And to refer it in the documentation as @DEMO.GIF having this to be replaced with the path to the file.