sile-typesetter / sile

The SILE Typesetter — Simon’s Improved Layout Engine
https://sile-typesetter.org
MIT License
1.64k stars 97 forks source link

Package documentation #1194

Open Omikhleia opened 3 years ago

Omikhleia commented 3 years ago

Greetings

SILE 0.10.15 on Ubuntu 20.04

In order to properly document my own package, I tried understanding the autodoc package, and have several concerns.

First, I couldn't find any documentation about it, some made test and trial attempt looking at the SILE manual code. I ended up with the following kind of script (for illustration):

\begin[papersize=6in x 9in, class=book]{document}
\script[src=packages/autodoc]
\script[src=packages/color]
\script[src=packages/rules]

\define[command=code]{\process}
\define[command=note]{\process}
\define[command=dots]{\process}

\bigskip
\package-documentation[src=packages/autodoc] % A standard package

\bigskip
\package-documentation[src=packages/color] % A standard package
\end{document}

Main issues:

All in all, it summarizes to "how to get working documentation for existing packages", and "how should package authors make working documentation"

Secondary issues:

I do feel that enforcing (to some extent) packages to be properly documented improves maintainability and usability. The current autodoc packages looks (no offense intended) as a quick "hack" for the SILE manual. Are there plans or ideas how to correctly handle package documentation? That could include:

Regards.

EDIT: Beyond the (small) initial step proposed in PR #1335 ("stage 0"), here is how I would consider subsequent stages... At a slow pace... from simplest ideas to the more complex or challenging:

Omikhleia commented 2 years ago

EDIT: proposed tasks moved to the issue description as per alerque's tip below.

alerque commented 2 years ago

Yes to all points above.

An \autodoc:package command would be especially useful if it did things like link the package name to the corresponding location in the manual.

c.f. #1337 for a related idea that has been kicking around in my head for a while do document internal Lua API stuff rather than just end user facing commands.

alerque commented 2 years ago

Also re information extraction, note our SILE.registerCommand() function has help strings for lots of functions that we basically don't utilize. That might be a jumping off point for more information too. c.f. #1195

Omikhleia commented 2 years ago

An \autodoc:package command would be especially useful if it did things like link the package name to the corresponding location in the manual.

Neat idea indeed. I have added it to my proposed task list above (slightly re-ordered, this is the most probable ordering I'll consider).

alerque commented 2 years ago

Just a GitHub tip: can I suggest you edit the task list above into the original first post in this thread? If you do that GitHub will show the number of complete/incomplete tasks and a progress bar when the issue is references, especially in places such as milestones.