Collection-based Raku Documentation

AUTHOR

Richard Hainsworth, aka finanalyst

This Module provides a local website of the Raku documentation that can be made available via a browser at localhost:3000 . The Module uses Collection and Raku::Pod::Render to link all the Rakudoc (aka Pod6) files together.

The website is intended to be served locally with a Cro app. Since making Cro a dependency can cause problems in a testing environment, the META6.json does not have Cro as a dependency. If Cro::HTTP is not installed, the completion plugin will exit with a note.

The Website also demonstrates some of the custom blocks possible using Raku::Pod::Render.

Installation

zef install Collection-Raku-Documentation

This installs the Collection (and other) dependencies and the Raku-Doc executable. These in turn install the the other main distributions and Raku::Pod::Render. By default Raku::Pod::Render does not install the highlighter automatically because node.js and npm are required.

See Highlighting for installation of highlighter.

Raku-Doc

On a Linux based distributions, Raku-Doc depends on git and unzip, which typically are installed by default, to get and unpack other files.

Under Linux, in a terminal, the following will lead to the installation of a local copy of Raku docs and start a Cro app that will make the HTML documentation available in a browser at localhost:30000, and produce a progress status bar for the longer stages.

mkdir ~/raku-collection
    cd raku-collection
    Raku-Doc Init

This sets up a Collection directory by downloading the Website mode from github, then installs the Collection plugins.

By default the Raku/doc repository (containing all the Raku documentation files) will be created in the next step as local_raku_docs.

If a user wants to clone the Raku docs repository elsewhere or has an existing clone of the Raku repository, then the non-default path needs to be put into the config.raku file in the sources-obtain and sources-refresh keys. See the documentation for the Collection distribution for more information.

At the next invocation of Raku-Doc, the documentation source will be cloned, cached, and rendered.

For example, to render the full Raku Docs, the following would work, where raku-local is a local directory.

- raku-collection
        - local_raku_docs # this is generated by the git clone command
        - Website # this is generated by runnng 'Raku-Doc Init' in raku-collection
        config.raku # as Website

After the Init stage, calling Raku-Doc without any other options implies the mode Website with default options.

The Raku Documentation source files are regularly updated. The Website mode is configured to pull the latest versions of the source files into the Collection whenever Raku-Doc is run, which then updates the cache for any sources that have changed, and then re-render all the html files that are affected. These stages are automatically called by running Raku-Doc with the config defaults given.

The Website mode files and plugins are being actively developed, so newer versions may be available. New versions of the plugins are automatically called on each invocation of Raku-Doc. To get new versions of the Website mode files (sources and additional plugins), use

Raku-Doc Update

Raku-Doc can be called with other options, which are described in the Collection documentation.

Collection-Raku-Documentation is set up with the default mode called Website.

Raku-Doc as a wrapper for Collection::collect

With the exception of 'Init' and 'Update', Raku-Doc can be called with all the options listed for Collection::collect.

More information about these options is given in the Documentation for Collection.

In the future (not now)

If Raku-Doc is called with a string other than 'Init' or 'Website', then the string is interpreted as another Mode, with its own sub-directory and Configuration for the collection. For example,

Raku-Doc Book

would create the collection output defined by the configuration in the sub-directory Book/config/. This design is to allow for the creation of different Collection outputs to be defined for the same content files.

Enabling Cro App

A Cro App is included that will run the website automatically by running Raku-Doc. The Cro App is called using a plugin that runs after the html files have been refreshed. The Cro App is called at completion (see Collection documentation). It contains a test to see if Cro::HTTP is installed.

Since installing Cro can cause testing problems, this distribution does not have Cro::HTTP as a dependency.

Cro in installed using zef as

zef install Cro::HTTP

Running Raku-Doc without options will now serve the documentation files locally on port 3000. So point your browser at localhost:3000

Highlighting

The default highlighter at present is a Node based toolstack called atom-perl-highlighter. In order to install it automatically, Raku::Pod::Render requires an uptodate version of npm. The builder is known not to work with node.js > v13.0> and npm > v14.15.

For someone who has not installed node or npm before, or for whom they are only needed for the highlighter, the installation is ... confusing. It would seem at the time of writing that the easiest method is:

# Using Ubuntu
    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install -y nodejs

Then, after the default installation of Raku::Pod::Render, highlighting can be enabled by running the following in a terminal:

raku-render-install-highlighter

Problems

Collection is still being actively developed.

  • When running Raku-Doc with a sources-refresh key set to a git pull stanza, Raku-Doc teminates after a git pull. Workaround: run Raku-Doc again.

Copyright and License

(c) Richard N Hainsworth, 2021-2022

LICENSE Artistic-2.0

Collection-Raku-Documentation v0.12.1

Use Cro and Collection to supply Raku documentation. Different search system. Global and local TOCs and Glossaries.

Authors

  • Richard Hainsworth

License

Artistic-2.0

Dependencies

RakuConfigCollectionCollection::RefreshPluginsLibCurl::Easy

Test Dependencies

Provides

  • Collection::RakuDoc

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.