Subject: Re: bug#53205: 28.0.90; [PATCH] GNU ELPA: Provide more control over linked documentation

From: Y. E. <[email-masked]>
Date: Fri, 14 Jan 2022 16:59:18 +0200

> Y. E. <[email-masked]> writes:

> Thinking about improving images output for Company local HTML doc, may
> it become possible to allow adding small quantity per-package page
> styles directly to the ELPA repository?
>
> Having an HTML "package-name wrapper" could allow doing something like:
>
> #pkg-company img {
>     max-width: 300px;
> }

Sorry, my mind was confused at that moment, so I shifted the focus from
the local HTML doc styles to the main package page styles. Even though
the suggested stays valid for the main page styles, the local HTML doc
styles would have to be included to the generated HTML first, of course.

I meant to suggest the following approach:

#+BEGIN_SRC diff
diff --git a/elpa-admin.el b/elpa-admin.el
index d570c3c6aa..cad33482cb 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -2047,7 +2047,12 @@ directory; one of archive, archive-devel."
 	  (concat (make-temp-name (expand-file-name "doc")) ".html")))
     (with-temp-buffer
       (elpaa--call-sandboxed
-       t "makeinfo" "--no-split" "--html" docfile "-o" tmpfile)
+       t "makeinfo" "--no-split" "--html" docfile
+       "-c"  (format "AFTER_BODY_OPEN=<div id=\"pkg-%s\">"
+                     (car pkg-spec))
+       "-c" "PRE_BODY_CLOSE=</div>"
+       "--css-ref" "../../html/doc-html.css" ; TODO: Use robust path.
+       "-o" tmpfile)
       (message "%s" (buffer-string)))
     (rename-file tmpfile html-file t)
     ;; FIXME: Use `push' in Emacs≥28
#+END_SRC

'<elpa>/html/doc-html.css' then could contain:

#+BEGIN_SRC css
#pkg-company img {
    /* Until images output is fixed, hide them. */
    display: none;
    /* max-width: 360px; */
    /* margin-bottom: 0.8em; */
}
#+END_SRC

Would it be fine to follow this route?