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.

Installation

In order to install the example, start by cloning the GitHub repository:

$ git clone git@github.com:LinkedSoftwareDependencies/Documentation-Components.js.git

After that, navigate to the repo directory and install its dependencies:

$ cd Documentation-Components.js
$ npm install

Example contents

This example contains the following elements:

Run node bin/serve.js config/log_page.jsonld.

Note

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

The configuration config/log_page.jsonld contains an instantiation of PageLogger that will log a certain page to the console.

This logger is invoked with a MarkdownPage as logPage parameter. 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

Run node bin/serve.js config/serve_page.jsonld.

The configuration config/serve_page.jsonld contains an instantiation of PageServer that will serve a certain page via HTTP.

This logger is invoked with a MarkdownPage as servePage parameter and uses 8080 as default servePort.