#fedora #hat #module #generate #tool #documentation #red #asciidoc #formatted

app newdoc

Generate pre-populated module files formatted with AsciiDoc that are used in Red Hat and Fedora documentation

24 stable releases

2.9.3 Jul 21, 2021
2.8.2 May 19, 2021
2.6.4 Mar 8, 2021
2.6.2 Oct 20, 2020
2.3.4 Jun 24, 2020

#23 in Command line utilities

Download history 49/week @ 2021-04-06 56/week @ 2021-04-13 17/week @ 2021-04-20 23/week @ 2021-04-27 22/week @ 2021-05-04 12/week @ 2021-05-11 57/week @ 2021-05-18 3/week @ 2021-05-25 22/week @ 2021-06-08 1/week @ 2021-06-22 9/week @ 2021-06-29 2/week @ 2021-07-06 30/week @ 2021-07-13 58/week @ 2021-07-20

71 downloads per month

GPL-3.0-or-later

105KB
1.5K SLoC

Rust 1.5K SLoC // 0.1% comments AsciiDoc 242 SLoC // 0.5% comments RPM Specfile 25 SLoC

The newdoc tool

Crates.io Crates.io Crates.io

Travis (.org) AppVeyor Copr build

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 Modular Documentation guidelines: https://redhat-documentation.github.io/modular-docs/.

Installing newdoc

  • To install newdoc on Fedora, RHEL, or CentOS, use the Copr package repository:

    # dnf copr enable mareksu/newdoc-rs
    # dnf install newdoc
    
    $ newdoc
    

    Note that the Copr repository distributes packages only for supported releases of Fedora. If you have enabled the repository but the package fails to install, check if your Fedora is still supported.

  • To install newdoc from source on a Linux distribution, on macOS, or on Microsoft Windows, use the cargo package manager:

    $ cargo install newdoc
    
    $ newdoc
    

    For installing cargo, see https://rustup.rs/.

  • To install newdoc as a Docker image, use the docker or podman tool. If you use podman, replace docker with podman in the following commands:

    $ docker pull mrksu/newdoc
    
    $ docker run mrksu/newdoc
    

    Warning: The container currently does not generate files properly. For details and a workaround, see Issue #17.

Updating newdoc

  • To update newdoc that is installed from RPM, use the DNF package manager:

    # dnf --refresh upgrade newdoc
    
  • To update newdoc from source, use the cargo package manager:

    $ cargo install newdoc
    
  • To update newdoc from Docker, use the docker or podman tool:

    $ docker pull mrksu/newdoc
    

Creating a new module

  1. 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.

  2. Rewrite the placeholders in the generated file with your docs.

Creating a new assembly

  1. 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".

  2. 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.

    Alternatively, you can use the --include-in option when creating the assembly to generate modules and include them automatically, in a single step. See the description in the Options section.

Validating a file for Red Hat requirements

You can use the --validate (-l) option to check an existing file for Red Hat publishing requirements. For example:

$ newdoc --validate modules/empty-file.adoc

💾 File: empty-file.adoc
    🔴 Error: The file has no title or headings.
    🔴 Error: The file is missing an ID.
    🔶 Warning: The file is missing the _abstract flag. The flag is recommended but not required.
    🔴 Error: Cannot determine the module type.
$ newdoc --validate modules/con_proper-module.adoc

💾 File: modules/con_proper-module.adoc
    🔷 Information: No issues found in this file.

Options

  • To generate the file without the explanatory comments, add the --no-comments or -C option when creating documents.

  • To generate the file without the example, placeholder content, add the --no-examples or -E option when creating documents.

  • To create the file without the module type prefix in the ID and the file name, 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.

For more options, see the output of the following command:

$ newdoc --help

Release notes

You can find a brief change log on the Releases page.

Additional resources

Dependencies

~6MB
~127K SLoC