There are few features I like in documentation and I do not know how to get them with cargo rust doc
How does one get the location of the current page, relative to the entire documentation tree, on the left side margin and the headings within the current page on the right side margin. For example; see begin_cmd - xrst documentation
How does one have two levels of documentation. One, for uses, that defines the package API and that just links within itself. Another, for developers, that automatically includes and can link to all the user documentation.
How does one turn off the documentation of some public items (that are not part of the user API) when building the user documentation and turn it on when building the developer documentation.
I have a particular case in mind now. There is a sub-module that is public because it defines some constants that are used elsewhere. The entire module is an implementation detail and not part of the API. I want to include its documentation for the developer and hide it form the user. How do I do this ?
At the project directory level, I use the bin sub-directory for scripts that help maintain a the project. I added the bin/doc_hidden.sh script (below) so that I would not need to use the unstable version of rust. This only works for files that have been checked into the git repository.
if [ "$0" != "bin/doc_hidden.sh" ]
then
echo "bin/doc_hidden.sh: must be executed from its parent directory"
exit 1
fi
#
# pattern
pattern='^ *#\[doc(hidden)\] *$'
list=$( git grep -l "$pattern" )
for file in $list
do
mv $file $file.bak
sed -e "/$pattern/d" $file.bak > $file
done
cargo doc
for file in $list
do
mv $file.bak $file
done
echo 'bin/doc_hidden.sh: OK'
It seems that if I change some of my pub declarations to pub(crate) I do not need the #[doc(hidden)] commands. In fact, this is really better (for my purpose).