The newdoc
tool generates pre-populated module and assembly files formatted with AsciiDoc, which are used in Red Hat and Fedora documentation. The generated files follow the template guidelines maintained by the Modular Documentation initiative: https://redhat-documentation.github.io/modular-docs/.
The tool is written in the Rust programming language.
-
To install
newdoc
on Fedora, RHEL, or CentOS, use the Copr package repository:# dnf copr enable mareksu/newdoc-rs # dnf install newdoc $ newdoc
-
To install
newdoc
as a Docker image, use thedocker
orpodman
tool. If you usepodman
, replacedocker
withpodman
in the following commands:$ docker pull mrksu/newdoc $ docker run mrksu/newdoc
-
To install
newdoc
from source on a Linux distribution, on macOS, or on Microsoft Windows, use thecargo
package manager:$ cargo install newdoc $ newdoc
For installing
cargo
, see https://rustup.rs/.
-
To update
newdoc
that is installed from RPM, use the DNF package manager:# dnf upgrade newdoc
-
To update
newdoc
from Docker, use thedocker
orpodman
tool:$ docker pull mrksu/newdoc
-
To update
newdoc
from source, use thecargo
package manager:$ cargo install newdoc
-
In the directory where modules are located, use
newdoc
to create a new file:modules-dir]$ newdoc --procedure "Setting up thing"
The script also accepts the
--concept
and--reference
options. You can use these short forms instead:-p
,-c
, and-r
. -
Rewrite the placeholders in the generated file with your docs.
-
In the directory where assemblies are located, use
newdoc
to create a new file:assemblies-dir]$ newdoc --assembly "Achieving thing"
You can use the short form of the
--assembly
option instead:newdoc -a "Achieving thing"
. -
Rewrite the placeholders in the generated file with your docs.
Add AsciiDoc include statements to include modules. See Include Files in the AsciiDoc Syntax Quick Reference.
-
To generate the file without the explanatory comments, add the
--no-comments
or-C
option when creating documents. -
To create the file without the file-name prefix, add the
--no-prefixes
or-P
option. -
To specify the directory where
newdoc
saves the generated file, add the--target-dir=<directory>
or-T <directory>
option. -
To generate an assembly with include statements for other generated modules, use the
--include-in
or-i
option:$ newdoc --include-in "An assembly for two modules" --concept "First module" --procedure "Second module"
This creates the two modules and an assembly that features the include statements for the modules.
-
Install the
cargo
package manager. For details, see https://rustup.rs/. -
Install the
cargo-rpm
extension:$ cargo install cargo-rpm
-
In the
newdoc
project directory, build RPM packages:$ cargo rpm build
This command build packages in the
target/release/rpmbuild/
directory. -
Log into the Copr repository administration: https://copr.fedorainfracloud.org/coprs/mareksu/newdoc-rs/.
-
Go to the Builds tab.
-
Click New Build and select Upload.
-
In the Provide the source section, upload the most recent SRPM package from the
target/release/rpmbuild/SRPMS/
directory. -
Click Build.
Note: The following steps might be sub-optimal. Feel free to suggest improvements.
-
Install the
docker
orpodman
tool.If you use
podman
, replacedocker
withpodman
in the following commands. -
Log into the Docker Hub account:
$ docker login --username mrksu docker.io
-
Build a new image. For example:
$ docker build -t mrksu/newdoc:v2.3.3 .
-
Find the Image ID of the built image:
$ docker images
-
Tag the new version. For example:
$ docker tag 390e73cb470d mrksu/newdoc:v2.3.3
-
Upload the new image:
$ docker push mrksu/newdoc:v2.3.3