As an example, this documentation has been made self-instantiatable using Components.js. This makes it possible to view the HTML-version of any page to the console, or serve it via HTTP on a local webserver.
The necessary files for this instantiation are available on the GitHub repository of this documentation.
In order to install the example, start by cloning the GitHub repository:
$ git clone firstname.lastname@example.org:LinkedSoftwareDependencies/Documentation-Components.js.git
After that, navigate to the repo directory and install its dependencies:
$ cd Documentation-Components.js $ npm install
This example contains the following elements:
components/components.jsonldcontaining the module
npmd:documentation-componentsand links to the separate component files:
- A JSON-LD context file
package.jsonfile contains links to the module id, the components file and the context file.
- A simple script
bin/serve.jsthat uses Components.js to run the given config file with a fixed config URI
urn:components:documentation. For this example, all config files share this URI as
Print a page to the console
node bin/serve.js config/log_page.jsonld.
Instead of running the example with a local path,
it can also refer to an URL of a config, such as the URL of this config file on GitHub:
node bin/serve.js https://raw.githubusercontent.com/LinkedSoftwareDependencies/Documentation-Components.js/master/config/serve_page.jsonld
This logger is invoked with a
This page has a path to a certain Markdown page, which at the moment refers to
docs/index.md, which is the index page of the documentation.
This value can be any changed to refer to any other page from the documentation.
Serving a page using HTTP
node bin/serve.js config/serve_page.jsonld.